< prev index next >

src/os/linux/vm/os_linux.cpp

Print this page




2385 
2386 void os::print_jni_name_suffix_on(outputStream* st, int args_size) {
2387   // no suffix required
2388 }
2389 
2390 ////////////////////////////////////////////////////////////////////////////////
2391 // sun.misc.Signal support
2392 
2393 static volatile jint sigint_count = 0;
2394 
2395 static void UserHandler(int sig, void *siginfo, void *context) {
2396   // 4511530 - sem_post is serialized and handled by the manager thread. When
2397   // the program is interrupted by Ctrl-C, SIGINT is sent to every thread. We
2398   // don't want to flood the manager thread with sem_post requests.
2399   if (sig == SIGINT && Atomic::add(1, &sigint_count) > 1) {
2400     return;
2401   }
2402 
2403   // Ctrl-C is pressed during error reporting, likely because the error
2404   // handler fails to abort. Let VM die immediately.
2405   if (sig == SIGINT && is_error_reported()) {
2406     os::die();
2407   }
2408 
2409   os::signal_notify(sig);
2410 }
2411 
2412 void* os::user_handler() {
2413   return CAST_FROM_FN_PTR(void*, UserHandler);
2414 }
2415 
2416 struct timespec PosixSemaphore::create_timespec(unsigned int sec, int nsec) {
2417   struct timespec ts;
2418   // Semaphore's are always associated with CLOCK_REALTIME
2419   os::Linux::clock_gettime(CLOCK_REALTIME, &ts);
2420   // see unpackTime for discussion on overflow checking
2421   if (sec >= MAX_SECS) {
2422     ts.tv_sec += MAX_SECS;
2423     ts.tv_nsec = 0;
2424   } else {
2425     ts.tv_sec += sec;




2385 
2386 void os::print_jni_name_suffix_on(outputStream* st, int args_size) {
2387   // no suffix required
2388 }
2389 
2390 ////////////////////////////////////////////////////////////////////////////////
2391 // sun.misc.Signal support
2392 
2393 static volatile jint sigint_count = 0;
2394 
2395 static void UserHandler(int sig, void *siginfo, void *context) {
2396   // 4511530 - sem_post is serialized and handled by the manager thread. When
2397   // the program is interrupted by Ctrl-C, SIGINT is sent to every thread. We
2398   // don't want to flood the manager thread with sem_post requests.
2399   if (sig == SIGINT && Atomic::add(1, &sigint_count) > 1) {
2400     return;
2401   }
2402 
2403   // Ctrl-C is pressed during error reporting, likely because the error
2404   // handler fails to abort. Let VM die immediately.
2405   if (sig == SIGINT && VMError::is_error_reported()) {
2406     os::die();
2407   }
2408 
2409   os::signal_notify(sig);
2410 }
2411 
2412 void* os::user_handler() {
2413   return CAST_FROM_FN_PTR(void*, UserHandler);
2414 }
2415 
2416 struct timespec PosixSemaphore::create_timespec(unsigned int sec, int nsec) {
2417   struct timespec ts;
2418   // Semaphore's are always associated with CLOCK_REALTIME
2419   os::Linux::clock_gettime(CLOCK_REALTIME, &ts);
2420   // see unpackTime for discussion on overflow checking
2421   if (sec >= MAX_SECS) {
2422     ts.tv_sec += MAX_SECS;
2423     ts.tv_nsec = 0;
2424   } else {
2425     ts.tv_sec += sec;


< prev index next >