• 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
Re: non-blocking file writes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: non-blocking file writes


  • Subject: Re: non-blocking file writes
  • From: Sherm Pendley <email@hidden>
  • Date: Mon, 7 Jul 2003 19:58:16 -0400

On Monday, July 7, 2003, at 10:40 AM, Devon E Bowen wrote:

I'm a UNIX guy but with little Cocoa experience. I'm looking for a way
to read and write data (ints, chars, etc) to a file. Sounds simple
enough but I want to do it in a way that guarantees non-blocking I/O.
I poked around through the docs and ran across NSFileHandle which seems
to support methods for non-blocking reads (readInBackgroundAndNotify)
but not for writes.

Yep, you're right - NSFileHandle doesn't do that. It seems to me like a strange omission. ;-(

As an alternative, you could create an NSMutableData object with +dataWithContentsOfMappedFile: to use memory-mapped file IO. It's basically an object-oriented wrapper around mmap() and friends, if you're familiar with those. That way you'd just need to store your data in memory, and the virtual memory system would write it out to disk as needed.

sherm--

The highest sounds are hardest to hear.
Going forward is a way to retreat.
Great talent shows itself late in life.
Even a perfect program still has bugs.

-- The Tao of Programming
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >non-blocking file writes (From: Devon E Bowen <email@hidden>)

  • Prev by Date: nswindow resize question
  • Next by Date: Re: When the sender is an NSMatrix...
  • Previous by thread: Re: non-blocking file writes
  • Next by thread: Re: non-blocking file writes
  • Index(es):
    • Date
    • Thread