< prev index next >

src/os/bsd/vm/os_bsd.cpp

Print this page




1830 
1831 void os::print_jni_name_suffix_on(outputStream* st, int args_size) {
1832   // no suffix required
1833 }
1834 
1835 ////////////////////////////////////////////////////////////////////////////////
1836 // sun.misc.Signal support
1837 
1838 static volatile jint sigint_count = 0;
1839 
1840 static void UserHandler(int sig, void *siginfo, void *context) {
1841   // 4511530 - sem_post is serialized and handled by the manager thread. When
1842   // the program is interrupted by Ctrl-C, SIGINT is sent to every thread. We
1843   // don't want to flood the manager thread with sem_post requests.
1844   if (sig == SIGINT && Atomic::add(1, &sigint_count) > 1) {
1845     return;
1846   }
1847 
1848   // Ctrl-C is pressed during error reporting, likely because the error
1849   // handler fails to abort. Let VM die immediately.
1850   if (sig == SIGINT && is_error_reported()) {
1851     os::die();
1852   }
1853 
1854   os::signal_notify(sig);
1855 }
1856 
1857 void* os::user_handler() {
1858   return CAST_FROM_FN_PTR(void*, UserHandler);
1859 }
1860 
1861 extern "C" {
1862   typedef void (*sa_handler_t)(int);
1863   typedef void (*sa_sigaction_t)(int, siginfo_t *, void *);
1864 }
1865 
1866 void* os::signal(int signal_number, void* handler) {
1867   struct sigaction sigAct, oldSigAct;
1868 
1869   sigfillset(&(sigAct.sa_mask));
1870   sigAct.sa_flags   = SA_RESTART|SA_SIGINFO;




1830 
1831 void os::print_jni_name_suffix_on(outputStream* st, int args_size) {
1832   // no suffix required
1833 }
1834 
1835 ////////////////////////////////////////////////////////////////////////////////
1836 // sun.misc.Signal support
1837 
1838 static volatile jint sigint_count = 0;
1839 
1840 static void UserHandler(int sig, void *siginfo, void *context) {
1841   // 4511530 - sem_post is serialized and handled by the manager thread. When
1842   // the program is interrupted by Ctrl-C, SIGINT is sent to every thread. We
1843   // don't want to flood the manager thread with sem_post requests.
1844   if (sig == SIGINT && Atomic::add(1, &sigint_count) > 1) {
1845     return;
1846   }
1847 
1848   // Ctrl-C is pressed during error reporting, likely because the error
1849   // handler fails to abort. Let VM die immediately.
1850   if (sig == SIGINT && VMError::is_error_reported()) {
1851     os::die();
1852   }
1853 
1854   os::signal_notify(sig);
1855 }
1856 
1857 void* os::user_handler() {
1858   return CAST_FROM_FN_PTR(void*, UserHandler);
1859 }
1860 
1861 extern "C" {
1862   typedef void (*sa_handler_t)(int);
1863   typedef void (*sa_sigaction_t)(int, siginfo_t *, void *);
1864 }
1865 
1866 void* os::signal(int signal_number, void* handler) {
1867   struct sigaction sigAct, oldSigAct;
1868 
1869   sigfillset(&(sigAct.sa_mask));
1870   sigAct.sa_flags   = SA_RESTART|SA_SIGINFO;


< prev index next >