comparison src/os/linux/vm/os_linux.cpp @ 14291:5944dba4badc

8028280: ParkEvent leak when running modified runThese which only loads classes Summary: Use spin lock to manage ParkEvent and PlatformEvent free lists. Reviewed-by: dholmes, fparain
author dsimms
date Fri, 24 Jan 2014 09:28:47 +0100
parents c250880a6673
children b59507f713e0 8cfe6fdbb99a
comparison
equal deleted inserted replaced
14290:d050fbf914d8 14291:5944dba4badc
3869 } 3869 }
3870 return OS_OK ; 3870 return OS_OK ;
3871 } 3871 }
3872 } 3872 }
3873 3873
3874 int os::naked_sleep() { 3874 //
3875 // %% make the sleep time an integer flag. for now use 1 millisec. 3875 // Short sleep, direct OS call.
3876 return os::sleep(Thread::current(), 1, false); 3876 //
3877 // Note: certain versions of Linux CFS scheduler (since 2.6.23) do not guarantee
3878 // sched_yield(2) will actually give up the CPU:
3879 //
3880 // * Alone on this pariticular CPU, keeps running.
3881 // * Before the introduction of "skip_buddy" with "compat_yield" disabled
3882 // (pre 2.6.39).
3883 //
3884 // So calling this with 0 is an alternative.
3885 //
3886 void os::naked_short_sleep(jlong ms) {
3887 struct timespec req;
3888
3889 assert(ms < 1000, "Un-interruptable sleep, short time use only");
3890 req.tv_sec = 0;
3891 if (ms > 0) {
3892 req.tv_nsec = (ms % 1000) * 1000000;
3893 }
3894 else {
3895 req.tv_nsec = 1;
3896 }
3897
3898 nanosleep(&req, NULL);
3899
3900 return;
3877 } 3901 }
3878 3902
3879 // Sleep forever; naked call to OS-specific sleep; use with CAUTION 3903 // Sleep forever; naked call to OS-specific sleep; use with CAUTION
3880 void os::infinite_sleep() { 3904 void os::infinite_sleep() {
3881 while (true) { // sleep forever ... 3905 while (true) { // sleep forever ...