This is the mail archive of the pthreads-win32@sources.redhat.com mailing list for the pthreas-win32 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: problem using pthread_cancel and pthread_mutex_lock


Hi Simon,

I've been using this technique in my apps and it works well.

Unfortunately however select() seems to be buggy, from my reading of the
docs it should act exactly the same way, ie. it should return as soon as
the socket is shutdown() - but it doesn't :(.

This is a bit of a problem as it's select as AFAIK only way to get
proper timeout behaviour on Windows...

Will


Simon Gerblich wrote:


Hi Viv,

I'm also writing code that we compile with redhat linux and pthreads-win32.

I get around your socket problem by having a tcp network class that does the
read(), write() calls etc.  recv() will return with an error if you call
shutdown()
and close()/closesocket() on the socket.
I have a call to shutdown() and close()/closesocket() in the destructor of
the class.
It works well for us.

Maybe you could call shutdown() and close()/closesocket() instead of
"killing the thread", and the recv() call will return and the thread can
shutdown
cleanly.

Simon





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]