Re: NSFileHandle thread safe ?
Re: NSFileHandle thread safe ?
- Subject: Re: NSFileHandle thread safe ?
- From: Ryan Britton <email@hidden>
- Date: Tue, 13 Sep 2005 13:30:35 -0700
From http://developer.apple.com/documentation/Cocoa/Reference/
Foundation/ObjC_classic/Classes/NSNotificationCenter.html
"In a multithreaded application, notifications are always delivered
in the thread in which the notification was posted, which may not be
the same thread in which an observer registered itself."
On Sep 13, 2005, at 10:05 AM, Alec Carlson wrote:
I am using an NSFileHandle to read/write to a device. For reading I
am using
the :readInBackgroundAndNotifyForModes: method. The device is
asynchronous
and can return data to the Mac at any time.
Now, when device data is read in the NSFileHandle background thread,
NSFileHandle posts an NSFileHandleReadCompletionNotification
notification.
My question is, are these notifications executed in the context of the
NSFileHandle background thread or are they executed off of the main
run loop
? This has a bearing on whether I can :writeData: from both the
main thread
AND the NSFileHandleReadCompletionNotification method. The
documentation
only specifies that the notification is posted, but not it's context.
Opinions ?
Thanx -
Alec Carlson
----------------------------------------------------------------------
-
Time is Short, and the Water Rises
----------------------------------------------------------------------
-
_______________________________________________
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
_______________________________________________
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