When attempting to interrupt a blocking concurrent queue that is waiting on a time out, I'm experiencing a hang (until the timeout) in this line
do {
#ifdef MOODYCAMEL_LIGHTWEIGHTSEMAPHORE_MONOTONIC
rc = sem_clockwait(&m_sema, CLOCK_MONOTONIC, &ts);
#else
rc = sem_timedwait(&m_sema, &ts);
#endif
} while (rc == -1 && errno == EINTR);
return rc == 0;
If I change it to respect the interrupt, the timeout doesn't work. However, I'm unable to ctrl-c in my program and shut it down cleanly. What can I do here short of implementing some sort of poll and a smaller timeout?
Also, out of curiosity, is there a benefit to using MOODYCAMEL_LIGHTWEIGHTSEMAPHORE_MONOTONIC?