• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
filehandle synchronizeFile is cached ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

filehandle synchronizeFile is cached ?


  • Subject: filehandle synchronizeFile is cached ?
  • From: Nicolas Berloquin <email@hidden>
  • Date: Thu, 17 Nov 2005 10:35:18 +0100

Hello !

I'm observing some strange behavior for NSFileHandle synchronizeFile.
The docs say that it will write to disk any data that remains in memory,
and that it only returns when done.
What I'm noticing is that sometimes, the sync is somehow queued and
the app becomes unresponsive until many cached syncs are written.
A sample taken at that time shows that most of the thread % is spent in fsync().
What's strange is that it's not always the case, as I can see in activity viewer that
frequent writes are done.


To put some perspective in this, here's what I'm doing :
I'm receiving data from the net that has to end up in a series of open files (can be 1 file,
can be many). As soon as I receive a certain amount of data, I write it to file (from memory
buffers), and I'd like to 'sync' it right away. The data arrives on a background thread, and
I send the synchronizeFile call through a performOnMainthread: waitUntilDone: NO.
The main thread isn't blocked before the visible freeze happens (UI is fluid etc), but of course
gets blocked by the accumulated syncs...


I have a vague memory about unix and always calling sync() three times in a row to make sure
it's really commited to disk. Should I do that ???


any suggestion is most welcome ! ;-)

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Multiple help menus?
  • Next by Date: Re: CoreRecipesApp and 10.4.3
  • Previous by thread: Re: Multiple help menus?
  • Next by thread: Sync Manager problem with Xcode 2.2
  • Index(es):
    • Date
    • Thread