Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: kqueue on OS X



On Feb 17, 2004, at 6:39 PM, Glen Low wrote:
On 18/02/2004, at 8:23 AM, Scott Lamb wrote:
On Feb 17, 2004, at 6:01 PM, Glen Low wrote:
Now pipes and file descriptors seem dangerous to me, since they are not necessarily threadsafe (especially with Cocoa)

Now, this is definitely not true. Two threads should be able to talk to each other on opposite ends of the same pipe without problem. And Cocoa doesn't have to enter the picture - you can use the raw system calls.


According to:

http://developer.apple.com/documentation/Cocoa/Conceptual/ Multithreading/Tasks/foundation.html

It says facilities which are generally thread-unsafe are:

... NSPipe ...

Sorry for being unclear. I'm trying to say that the underlying BSD system is thread-safe; I'm not surprised to hear NSPipe is not.

I am unsure if the underlying BSD pipe implementation is threadsafe, I can't see this one way or another by googling.

read(), write(), and pipe() are thread-safe according to SUSv3; they are defined in that standard yet not in this list of thread-unsafe functions:

<http://www.opengroup.org/onlinepubs/007904975/functions/ xsh_chap02_09.html>

Which is not to say that there aren't ways to misuse them. For example, I read on a Linux list that they do not define what happens if you close() a descriptor in one thread while another is working on the same descriptor. But that's different than two threads doing operations on opposite halves of a pipe.

Scott
_______________________________________________
darwin-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-development
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: kqueue on OS X (From: Glen Low <email@hidden>)
 >Re: kqueue on OS X (From: Scott Lamb <email@hidden>)
 >Re: kqueue on OS X (From: Glen Low <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.