Re: BSD sockets calls on OSX Tiger and thread safety
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Vincent On Oct 18, 2006, at 8:46 AM, Dave Zarzycki wrote: The APIs are thread safe. davez On Oct 18, 2006, at 8:38 AM, jmzorko@mac.com wrote: Hello, all ... Regards, John Falling You - exploring the beauty of voice and sound http://www.fallingyou.com _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... To illustrate what Dave said, if you call send() on the same socket file descriptor from 2 threads you have no guarantee on what data will be sent first. If ordering is important your program, need to provide your own synchronization mechanism. Sending from 2 threads on 2 distinct file descriptors is not a problem (except if the 2 file descriptors are logically related for a specific application but that's rather rare...) But like all thread safe APIs, one can still use them in an unsafe manner. How thread-safe is OSXs' BSD sockets implementation? Can I call select(), recv(), send(), socket(), setsockopt(), etc. from multiple threads simultaneously without locking, or are there things I need to be aware of? This email sent to site_archiver@lists.apple.com
participants (1)
-
Vincent Lubet