[LC++]sockets

Jan Pfeifer janpf at yahoo-inc.com
Thu Jul 4 01:06:06 UTC 2002


if there is no problems reading & writting simulaneously (according to Jack LLoyd) to the socket, you could just use a mutex around the writes only, not the read (to avoid the ABABAB problem he mentioned in previous email).

hope this helps, :)

jan


On Tue, 02 Jul 2002 22:04:31 +0200
Peter Poulsen <peter_poulsen at stofanet.dk> wrote:

> I know this is really a c question, but I'm programming in c++ so hope 
> it ok.
> 
> I have a couple of threads running, and i would like to know if it can 
> give any problems if one thread tries to write while another is reading?
> 
> As I see it I cannot but mutexs' around the socket, as the reading 
> thread just sit there and wait for something to come along. If I put 
> mutexs' around the socket, it would mean that all the sending threads 
> would wait for something to arrive before the reading thread would 
> release the lock.
> 
> To be more specifik: I have one reading thread, and multiple writing 
> threads.
> 
> -- 
> Yours/Med venlig hilsen
> Peter Poulsen
> Naessundvej 208
> 9220 Aalborg East
> +45 98 15 47 05
> 
> 
> _______________________________________________
> This is the Linux C++ Programming List
> : http://lists.linux.org.au/listinfo/tuxcpprogramming List
> 
> 




More information about the tuxCPProgramming mailing list