Re: Writing on a common socket from multiple threads
Re: Writing on a common socket from multiple threads
- Subject: Re: Writing on a common socket from multiple threads
- From: "Quinn \"The Eskimo!\"" <email@hidden>
- Date: Wed, 1 Jun 2011 17:03:59 -0700
On 1 Jun 2011, at 16:50, Josh Graessley wrote:
> One common problem with writing on a single socket from multiple threads is interleaved data.
Another one relates to closing. You have to make sure that you carefully coordinate the close of the socket, lest you run into problems like this:
1. thread A is writing to socket X via fd
2. thread B decides its time to close fd
3. thread C opens a file Y and gets back fd as the file descriptor
4. thread A is now writing to file Y rather than socket X
S+E
--
Quinn "The Eskimo!" <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden