Re: Multithread safety
- From: "Eugene Gershnik" <gershnik@xxxxxxxxxxx>
- Date: Wed, 9 Nov 2005 14:31:27 -0800
Nathan Evans wrote:
> I find this quite shocking.
>
> So you are saying that when you've got several threads on a completion
> port all posting WSARecv's on the same socket (potentially at the same
> instant in time) that there is a race condition?
Practically most likely not. What you do with WSARecv in such case is to
post a *request* to read not to perform an actual reading operation. The
reads themselves *presumably* will be serialized. According to MSDN docs on
CreateIoCompletionPort
<quote>
The I/O completion port places the completion packet in a first-in-first-out
queue.
</quote>
which I interpret as a sort of a promise that reads will be serialized.
However, posting multiple reads from different threads is still a bad idea.
Why would you want to do this?
--
Eugene
http://www.gershnik.com
.
- Follow-Ups:
- Re: Multithread safety
- From: Eugene Gershnik
- Re: Multithread safety
- References:
- Multithread safety
- From: Mike Gleason Jr Couturier
- Re: Multithread safety
- From: Eugene Gershnik
- Re: Multithread safety
- From: Nathan Evans
- Re: Multithread safety
- From: Eugene Gershnik
- Re: Multithread safety
- From: Nathan Evans
- Multithread safety
- Prev by Date: Re: Multithread safety
- Next by Date: RE: Serial data dropped by socket when using microsoft bluetooth s
- Previous by thread: Re: Multithread safety
- Next by thread: Re: Multithread safety
- Index(es):
Loading