unistd.h pause() not returning on sigint
The manpage for pause says:
Quote:
The issue with the code below is that pause does not return and it seems to me it should. Does anyone have some insight into this? Code:
#include <portaudio.h> |
I'm not familiar with signal handling and std::thread under C++, but in general, a signal such as sigint could be sent to any thread in the foreground process that has not blocked the signal. My guess is the thread running wait_thread.join() is receiving the signal instead of the one running wait_for_signal().
I think you may need to use something like sigprocmask() to make sure the signal can only go to the desired thread. But, I'm not a C++ guy, only C, so there may be a more C++ish way of doing this sort of thing. |
Thanks GazL. That was the answer.
My solution: Code:
#include <portaudio.h> |
While I was at it I thought I might as well encapsulate all the signal handling:
Code:
#include <portaudio.h> |
All times are GMT -5. The time now is 06:19 AM. |