• 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: Asynchronously writing to a file?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Asynchronously writing to a file?


  • Subject: Re: Asynchronously writing to a file?
  • From: Dan Bernstein <cocoa-dev%email@hidden>
  • Date: Thu, 13 Mar 2003 16:40:21 +0200

Thanks.

Actually, I already have writing in a dedicated thread. I have a pool of buffers which one thread fills up and another thread writes and returns to the pool.

The problem is that I the number of buffers is fixed. When another process on the system uses the disk I'm writing to heavily, sometimes the writing thread blocks for too long and I run out of buffers.

I thought maybe instead of rewriting my code to dynamically allocate additional buffers (which could be just as bad and just as blocking, if the allocation requires a pageout and the VM lives on that same disk) I should let the OS take care of it (using its own clever buffer allocation techniques).

-- Dan

On Thursday, March 13, 2003, at 04:01 PM, Robert Cerny wrote:

Hi,
the best way would be to stand another thread to write the file. I would recommend the create a copy of your document in memory (to prevent file corruption in case of user changes while saving it) and write it.

Robert
On Thursday, Mar 13, 2003, at 13:21 Europe/Prague, Dan Bernstein wrote:

Hi all,

I have an NSFileHandle I'd like to write to asynchronously (i.e. without blocking). What's the... simplest way to do this?

TIA,
-- Dan
_______________________________________________
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.
_______________________________________________
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.
_______________________________________________
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: 
 >Re: Asynchronously writing to a file? (From: Robert Cerny <email@hidden>)

  • Prev by Date: Re: Asynchronously writing to a file?
  • Next by Date: Re: Printing on both sides from a subclassed NSView
  • Previous by thread: Re: Asynchronously writing to a file?
  • Next by thread: Problems with displaying NSProgressIndicator in custom cell
  • Index(es):
    • Date
    • Thread