I'm using the zmqpp C++ binding of ZeroMQ for building a PUB/SUB communication.
On the subscriber side, there are 2 threads -- mainThread and pollingThread.
pollingThread contains a blocking call to zmqpp::poller::poll(zmqpp::poller::wait_forever).
How, from wihin mainThread, can I interrupt/cancel pollingThread's call to poll() ?
EDIT1: I'm using std::thread, so I can't interrupt the thread.
EDIT2: Here's basically pollingThread's function.
void pollingThread()
{
while (threadCanRun())
{
// wait indefinitely for a new message
if (mySocketPoller->poll())
{
functionToCallWhenAMessageArrives();
}
}
}