src/hotspot/os/windows/os_windows.cpp
changeset 53886 e94ed0236046
parent 53882 ca682d9d8db5
child 53919 554c3c813ad6
equal deleted inserted replaced
53885:e03bbe023e50 53886:e94ed0236046
  5318   SetEvent(_ParkEvent);
  5318   SetEvent(_ParkEvent);
  5319 }
  5319 }
  5320 
  5320 
  5321 // Platform Monitor implementation
  5321 // Platform Monitor implementation
  5322 
  5322 
  5323 os::PlatformMonitor::PlatformMonitor() {
       
  5324   InitializeConditionVariable(&_cond);
       
  5325   InitializeCriticalSection(&_mutex);
       
  5326 }
       
  5327 
       
  5328 os::PlatformMonitor::~PlatformMonitor() {
       
  5329   DeleteCriticalSection(&_mutex);
       
  5330 }
       
  5331 
       
  5332 void os::PlatformMonitor::lock() {
       
  5333   EnterCriticalSection(&_mutex);
       
  5334 }
       
  5335 
       
  5336 void os::PlatformMonitor::unlock() {
       
  5337   LeaveCriticalSection(&_mutex);
       
  5338 }
       
  5339 
       
  5340 bool os::PlatformMonitor::try_lock() {
       
  5341   return TryEnterCriticalSection(&_mutex);
       
  5342 }
       
  5343 
       
  5344 // Must already be locked
  5323 // Must already be locked
  5345 int os::PlatformMonitor::wait(jlong millis) {
  5324 int os::PlatformMonitor::wait(jlong millis) {
  5346   assert(millis >= 0, "negative timeout");
  5325   assert(millis >= 0, "negative timeout");
  5347   int ret = OS_TIMEOUT;
  5326   int ret = OS_TIMEOUT;
  5348   int status = SleepConditionVariableCS(&_cond, &_mutex,
  5327   int status = SleepConditionVariableCS(&_cond, &_mutex,
  5355     DWORD err = GetLastError();
  5334     DWORD err = GetLastError();
  5356     assert(err == ERROR_TIMEOUT, "SleepConditionVariableCS: %ld:", err);
  5335     assert(err == ERROR_TIMEOUT, "SleepConditionVariableCS: %ld:", err);
  5357   }
  5336   }
  5358   #endif
  5337   #endif
  5359   return ret;
  5338   return ret;
  5360 }
       
  5361 
       
  5362 void os::PlatformMonitor::notify() {
       
  5363   WakeConditionVariable(&_cond);
       
  5364 }
       
  5365 
       
  5366 void os::PlatformMonitor::notify_all() {
       
  5367   WakeAllConditionVariable(&_cond);
       
  5368 }
  5339 }
  5369 
  5340 
  5370 // Run the specified command in a separate process. Return its exit value,
  5341 // Run the specified command in a separate process. Return its exit value,
  5371 // or -1 on failure (e.g. can't create a new process).
  5342 // or -1 on failure (e.g. can't create a new process).
  5372 int os::fork_and_exec(char* cmd, bool use_vfork_if_available) {
  5343 int os::fork_and_exec(char* cmd, bool use_vfork_if_available) {