Re: pthreads & sockets
From: David Schwartz (davids_at_webmaster.com)
Date: 09/03/03
- Next message: VINAY: "memory management related system calls"
- Previous message: Kasper Dupont: "Re: open source windows"
- In reply to: Matjaž Terpin: "pthreads & sockets"
- Next in thread: Kasper Dupont: "Re: pthreads & sockets"
- Reply: Kasper Dupont: "Re: pthreads & sockets"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 3 Sep 2003 14:28:18 -0700
>2. Again there a two threads and one socket. The first thread opens the TCP
> connection, then the second thread executes a blocking recv() on the
same
> socket. At some time later, the first thread closes the socket (by
> calling close()). I would expect the recv() to return control, but it
> doesn't.
You must not do this. The problems have been discussed in this newsgroup
many times. The problem is that it is impossible to be 100% sure the other
thread is in 'recv' when you call 'close'. It could be about to call 'recv'.
DS
- Next message: VINAY: "memory management related system calls"
- Previous message: Kasper Dupont: "Re: open source windows"
- In reply to: Matjaž Terpin: "pthreads & sockets"
- Next in thread: Kasper Dupont: "Re: pthreads & sockets"
- Reply: Kasper Dupont: "Re: pthreads & sockets"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|