Da: Rutger ter Borg <rutger@terborg.net>
A: boost-users@lists.boost.org
Inviato: Mer 9 marzo 2011, 12:31:49
Oggetto: Re: [Boost-users] boost concurrent write/read
On 03/09/2011 12:14 PM, Marco Piacentini wrote:
> I have a simple TCP multiprocess server...inside each child
server(each
> of one handles distincted connection), I call a list of
> operation...suppose the following:
>
>
> socket.async_read_some(....); //receive a client request
> socket.async_write_some(...); //respond to client request
>
> socket.async_write_some(...); //independently of the client request,
> send something to the client
>
> Have I use strand,or this situation doesn't cause problems?
> I don't use thread...
> thanks!!!
Without threads, you don't need a strand (the strand is implicit).
But, even without threads, you still would need to make sure that the
read or write operation is completed before issueing your next request. So,
socket.async_read(...); // OK
socket.async_write( ... ); // OK
socket.async_read( ... ); // Potential error: 1st async_read may be
still in
progress
Regards,
Rutger
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.orghttp://lists.boost.org/mailman/listinfo.cgi/boost-users