|
|
| 20 |
|
20 |
|
| 21 |
#include <pthread.h> |
21 |
#include <pthread.h> |
| 22 |
#include <string.h> |
22 |
#include <string.h> |
|
|
23 |
#include <signal.h> |
| 23 |
#include "fatal-error.h" |
24 |
#include "fatal-error.h" |
| 24 |
#include "system-thread.h" |
25 |
#include "system-thread.h" |
| 25 |
#include "log.h" |
26 |
#include "log.h" |
|
|
| 61 |
: m_callback (callback) |
62 |
: m_callback (callback) |
| 62 |
{ |
63 |
{ |
| 63 |
NS_LOG_FUNCTION_NOARGS (); |
64 |
NS_LOG_FUNCTION_NOARGS (); |
|
|
65 |
// Make sure we have a SIGALRM handler which does not terminate |
| 66 |
// our process. |
| 67 |
struct sigaction act; |
| 68 |
act.sa_flags = 0; |
| 69 |
sigemptyset (&act.sa_mask); |
| 70 |
act.sa_handler = SIG_IGN; |
| 71 |
sigaction (SIGALRM, &act, 0); |
| 64 |
} |
72 |
} |
| 65 |
|
73 |
|
| 66 |
void |
74 |
void |
|
|
| 83 |
{ |
91 |
{ |
| 84 |
NS_LOG_FUNCTION_NOARGS (); |
92 |
NS_LOG_FUNCTION_NOARGS (); |
| 85 |
|
93 |
|
|
|
94 |
// send a SIGALRM signal on the target thread to make sure that it |
| 95 |
// will unblock. |
| 96 |
pthread_kill (m_thread, SIGALRM); |
| 86 |
void *thread_return; |
97 |
void *thread_return; |
| 87 |
int rc = pthread_join (m_thread, &thread_return); |
98 |
int rc = pthread_join (m_thread, &thread_return); |
| 88 |
if (rc) |
99 |
if (rc) |