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: BSD sockets calls on OSX Tiger and thread safety



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...)

Vincent

On Oct 18, 2006, at 8:46 AM, Dave Zarzycki wrote:

The APIs are thread safe.

But like all thread safe APIs, one can still use them in an unsafe manner.

davez

On Oct 18, 2006, at 8:38 AM, email@hidden wrote:


Hello, all ...

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?

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 (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden
References: 
 >BSD sockets calls on OSX Tiger and thread safety (From: email@hidden)
 >Re: BSD sockets calls on OSX Tiger and thread safety (From: Dave Zarzycki <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.