summaryrefslogtreecommitdiff
path: root/src/pal/src/exception/signal.cpp
diff options
context:
space:
mode:
authorAditya Mandaleeka <adityam@microsoft.com>2016-01-28 13:07:55 -0800
committerAditya Mandaleeka <adityam@microsoft.com>2016-01-28 13:07:55 -0800
commit3e483d6c5e31cc0cd1eacec7ee78871dccada9d5 (patch)
treea515af1c02df30132214e972a32ecfd42565d0d3 /src/pal/src/exception/signal.cpp
parent431f7ff1150561a9d27e29c155706e279328446a (diff)
downloadcoreclr-3e483d6c5e31cc0cd1eacec7ee78871dccada9d5.tar.gz
coreclr-3e483d6c5e31cc0cd1eacec7ee78871dccada9d5.tar.bz2
coreclr-3e483d6c5e31cc0cd1eacec7ee78871dccada9d5.zip
Use pthread_sigmask to change the mask of blocked signals.
Diffstat (limited to 'src/pal/src/exception/signal.cpp')
-rw-r--r--src/pal/src/exception/signal.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/pal/src/exception/signal.cpp b/src/pal/src/exception/signal.cpp
index 131433f077..055f7df95f 100644
--- a/src/pal/src/exception/signal.cpp
+++ b/src/pal/src/exception/signal.cpp
@@ -93,7 +93,7 @@ struct sigaction g_previous_sigquit;
Function :
SEHInitializeSignals
- Set-up signal handlers to catch signals and translate them to exceptions
+ Set up signal handlers to catch signals and translate them to exceptions
Parameters :
None
@@ -105,7 +105,7 @@ BOOL SEHInitializeSignals()
{
TRACE("Initializing signal handlers\n");
- /* we call handle signal for every possible signal, even
+ /* we call handle_signal for every possible signal, even
if we don't provide a signal handler.
handle_signal will set SA_RESTART flag for specified signal.
@@ -155,7 +155,7 @@ Parameters :
note :
reason for this function is that during PAL_Terminate, we reach a point where
SEH isn't possible anymore (handle manager is off, etc). Past that point,
-we can't avoid crashing on a signal
+we can't avoid crashing on a signal.
--*/
void SEHCleanupSignals()
{
@@ -605,13 +605,13 @@ Function :
Parameters :
PEXCEPTION_POINTERS pointers : exception information
- native_context_t *ucontext : context structure given to signal handler
int code : signal received
+ native_context_t *ucontext : context structure given to signal handler
(no return value)
Note:
- the "pointers" parameter should contain a valid exception record pointer,
- but the contextrecord pointer will be overwritten.
+ the "pointers" parameter should contain a valid exception record pointer,
+ but the ContextRecord pointer will be overwritten.
--*/
static void common_signal_handler(PEXCEPTION_POINTERS pointers, int code,
native_context_t *ucontext)
@@ -623,7 +623,7 @@ static void common_signal_handler(PEXCEPTION_POINTERS pointers, int code,
// which is required for restoring context
RtlCaptureContext(&context);
- // Fill context record with required information. from pal.h :
+ // Fill context record with required information. from pal.h:
// On non-Win32 platforms, the CONTEXT pointer in the
// PEXCEPTION_POINTERS will contain at least the CONTEXT_CONTROL registers.
CONTEXTFromNativeContext(ucontext, &context, CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT);
@@ -633,10 +633,11 @@ static void common_signal_handler(PEXCEPTION_POINTERS pointers, int code,
/* Unmask signal so we can receive it again */
sigemptyset(&signal_set);
sigaddset(&signal_set, code);
- if(-1 == sigprocmask(SIG_UNBLOCK, &signal_set, NULL))
+ int sigmaskRet = pthread_sigmask(SIG_UNBLOCK, &signal_set, NULL);
+ if (sigmaskRet != 0)
{
- ASSERT("sigprocmask failed; error is %d (%s)\n", errno, strerror(errno));
- }
+ ASSERT("pthread_sigmask failed; error number is %d\n", sigmaskRet);
+ }
SEHProcessException(pointers);
}