Changeset 13660 in vbox
- Timestamp:
- Oct 29, 2008 3:46:17 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/posix/thread-posix.cpp
r13653 r13660 46 46 #include <iprt/asm.h> 47 47 #include <iprt/err.h> 48 #include <iprt/string.h> 48 49 #include "internal/thread.h" 50 51 52 /******************************************************************************* 53 * Defined Constants And Macros * 54 *******************************************************************************/ 55 /** The signal we're using for RTThreadPoke. */ 56 #define RTTHREAD_POSIX_POKE_SIG SIGUSR2 49 57 50 58 … … 75 83 /* 76 84 * Register the dummy signal handler for RTThreadPoke. 77 */ 78 void (*pfnOld)(int); 79 pfnOld = signal(SIGUSR2, rtThreadPosixPokeSignal); 80 Assert(pfnOld == SIG_DFL); 85 * (Assert may explode here, but at least we'll notice.) 86 */ 87 struct sigaction SigAct; 88 memset(&SigAct, '\0', sizeof(SigAct)); 89 SigAct.sa_handler = rtThreadPosixPokeSignal; 90 sigfillset(&SigAct.sa_mask); 91 SigAct.sa_flags = 0; 92 93 struct sigaction SigActOld; 94 if (!sigaction(RTTHREAD_POSIX_POKE_SIG, &SigAct, &SigActOld)) 95 Assert(SigActOld.sa_handler == SIG_DFL); 96 else 97 { 98 rc = RTErrConvertFromErrno(errno); 99 AssertMsgFailed(("rc=%Rrc errno=%d\n", rc, errno)); 100 pthread_key_delete(g_SelfKey); 101 g_SelfKey = 0; 102 } 81 103 return rc; 82 104 } … … 109 131 static void rtThreadPosixPokeSignal(int iSignal) 110 132 { 111 Assert(iSignal == SIGUSR2);133 Assert(iSignal == RTTHREAD_POSIX_POKE_SIG); 112 134 NOREF(iSignal); 113 135 } … … 130 152 sigemptyset(&SigSet); 131 153 sigaddset(&SigSet, SIGALRM); 154 sigdelset(&SigSet, RTTHREAD_POSIX_POKE_SIG); 132 155 sigprocmask(SIG_BLOCK, &SigSet, NULL); 156 siginterrupt(RTTHREAD_POSIX_POKE_SIG, 1); 133 157 134 158 int rc = pthread_setspecific(g_SelfKey, pThread); … … 154 178 sigemptyset(&SigSet); 155 179 sigaddset(&SigSet, SIGALRM); 180 sigdelset(&SigSet, RTTHREAD_POSIX_POKE_SIG); 156 181 sigprocmask(SIG_BLOCK, &SigSet, NULL); 182 siginterrupt(RTTHREAD_POSIX_POKE_SIG, 1); 157 183 158 184 int rc = pthread_setspecific(g_SelfKey, pThread); … … 302 328 AssertReturn(pThread, VERR_INVALID_HANDLE); 303 329 304 int rc = pthread_kill((pthread_t)(uintptr_t)pThread->Core.Key, SIGUSR2);330 int rc = pthread_kill((pthread_t)(uintptr_t)pThread->Core.Key, RTTHREAD_POSIX_POKE_SIG); 305 331 306 332 rtThreadRelease(pThread);
Note:
See TracChangeset
for help on using the changeset viewer.