• 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: Thread safety of NSPipe
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Thread safety of NSPipe


  • Subject: Re: Thread safety of NSPipe
  • From: Charles Srstka <email@hidden>
  • Date: Thu, 11 Mar 2004 00:15:48 -0600

On Feb 18, 2004, at 8:12 AM, Glen Low wrote:

Consider the following scenario:

1. Main thread creates an NSPipe.
2. Main thread creates a writing NSFileHandle.
3. Main thread creates a reading NSFileHandle and detaches a worker
thread, passing it the NSFileHandle.
4. Main thread writes to the writing NSFileHandle.
5. Worker thread reads from the reading NSFileHandle.

Am I going to get corrupted data? In all cases, operations are
performed on different threads on different objects. (Deallocating the
NSPipe seems problematic, but if it is a static variable, it doesn't
need to get deallocated.)

I should think that this would work, since this is basically what happens when you use -[NSFileHandle readInBackgroundAndNotify], isn't it? A worker thread gets spawned which reads from the NSFileHandle.

Charles
_______________________________________________
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.


  • Follow-Ups:
    • Re: Thread safety of NSPipe
      • From: Glen Low <email@hidden>
  • Prev by Date: Re: mmalc's Controller examples: Bindings with graphics
  • Next by Date: NSString really Unicode?
  • Previous by thread: Re: Thread safety of NSPipe
  • Next by thread: Re: Thread safety of NSPipe
  • Index(es):
    • Date
    • Thread