hotspot/src/os/posix/vm/vmError_posix.cpp
changeset 46284 ad578adff5df
parent 40010 e32d5e545789
child 46361 b4c026dd6128
equal deleted inserted replaced
46283:09e328af295a 46284:ad578adff5df
     1 /*
     1 /*
     2  * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    56 static const int NUM_SIGNALS = sizeof(SIGNALS) / sizeof(int);
    56 static const int NUM_SIGNALS = sizeof(SIGNALS) / sizeof(int);
    57 
    57 
    58 // Space for our "saved" signal flags and handlers
    58 // Space for our "saved" signal flags and handlers
    59 static int resettedSigflags[NUM_SIGNALS];
    59 static int resettedSigflags[NUM_SIGNALS];
    60 static address resettedSighandler[NUM_SIGNALS];
    60 static address resettedSighandler[NUM_SIGNALS];
       
    61 
       
    62 // Needed for cancelable steps.
       
    63 static volatile pthread_t reporter_thread_id;
       
    64 
       
    65 void VMError::reporting_started() {
       
    66   // record pthread id of reporter thread.
       
    67   reporter_thread_id = ::pthread_self();
       
    68 }
       
    69 
       
    70 void VMError::interrupt_reporting_thread() {
       
    71   // We misuse SIGILL here, but it does not really matter. We need
       
    72   //  a signal which is handled by crash_handler and not likely to
       
    73   //  occurr during error reporting itself.
       
    74   ::pthread_kill(reporter_thread_id, SIGILL);
       
    75 }
    61 
    76 
    62 static void save_signal(int idx, int sig)
    77 static void save_signal(int idx, int sig)
    63 {
    78 {
    64   struct sigaction sa;
    79   struct sigaction sa;
    65   sigaction(sig, NULL, &sa);
    80   sigaction(sig, NULL, &sa);