Boost logo

Boost Users :

Subject: [Boost-users] Thread Interruption Best Practice
From: Dom Driver (domdriver_at_[hidden])
Date: 2011-03-20 17:45:46


Hi List,

I'm fairly new to boost, and have recently started to use the threading system from v1.46 in an app I'm writing targeting Linux. This was primarily to enable execution of threads to be blocked until a condition variable is set, at which point the thread is kicked awake and actions whatever is waiting to be done.

All good, and all working as expected.

However, I've got another thread which sits listening for data on a socket using a Linux select() call. This blocks until data is available for reading, at which point it is read from the socket as expected. This also works fine, except on termination of the application.

Using native Linux implementations, a signal can be sent to the thread that is blocking on the select() call, at which point the call returns, and the EINTR error is set. I can therefore check for this condition and handle appropriately.

Is there a way to send a Linux signal (or boost equivalent) to a specific boost thread to emulate this behaviour?

Failing that, is there an alternative implementation of the classic Linux select()/read() functionality using boost classes? I had a look at the async I/O library and it seems a bit convoluted.

TIA,

Dom

                                               



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net