src/hotspot/os/windows/os_windows.cpp
changeset 53646 043ae846819f
parent 53369 55cee96fefec
child 53687 e439ec989141
equal deleted inserted replaced
53645:2c6c0fabe6a2 53646:043ae846819f
  5275 void Parker::unpark() {
  5275 void Parker::unpark() {
  5276   guarantee(_ParkEvent != NULL, "invariant");
  5276   guarantee(_ParkEvent != NULL, "invariant");
  5277   SetEvent(_ParkEvent);
  5277   SetEvent(_ParkEvent);
  5278 }
  5278 }
  5279 
  5279 
       
  5280 // Platform Monitor implementation
       
  5281 
       
  5282 os::PlatformMonitor::PlatformMonitor() {
       
  5283   InitializeConditionVariable(&_cond);
       
  5284   InitializeCriticalSection(&_mutex);
       
  5285 }
       
  5286 
       
  5287 os::PlatformMonitor::~PlatformMonitor() {
       
  5288   DeleteCriticalSection(&_mutex);
       
  5289 }
       
  5290 
       
  5291 void os::PlatformMonitor::lock() {
       
  5292   EnterCriticalSection(&_mutex);
       
  5293 }
       
  5294 
       
  5295 void os::PlatformMonitor::unlock() {
       
  5296   LeaveCriticalSection(&_mutex);
       
  5297 }
       
  5298 
       
  5299 bool os::PlatformMonitor::try_lock() {
       
  5300   return TryEnterCriticalSection(&_mutex);
       
  5301 }
       
  5302 
       
  5303 // Must already be locked
       
  5304 int os::PlatformMonitor::wait(jlong millis) {
       
  5305   assert(millis >= 0, "negative timeout");
       
  5306   int ret = OS_TIMEOUT;
       
  5307   int status = SleepConditionVariableCS(&_cond, &_mutex,
       
  5308                                         millis == 0 ? INFINITE : millis);
       
  5309   if (status != 0) {
       
  5310     ret = OS_OK;
       
  5311   }
       
  5312   #ifndef PRODUCT
       
  5313   else {
       
  5314     DWORD err = GetLastError();
       
  5315     assert(err == ERROR_TIMEOUT, "SleepConditionVariableCS: %ld:", err);
       
  5316   }
       
  5317   #endif
       
  5318   return ret;
       
  5319 }
       
  5320 
       
  5321 void os::PlatformMonitor::notify() {
       
  5322   WakeConditionVariable(&_cond);
       
  5323 }
       
  5324 
       
  5325 void os::PlatformMonitor::notify_all() {
       
  5326   WakeAllConditionVariable(&_cond);
       
  5327 }
       
  5328 
  5280 // Run the specified command in a separate process. Return its exit value,
  5329 // Run the specified command in a separate process. Return its exit value,
  5281 // or -1 on failure (e.g. can't create a new process).
  5330 // or -1 on failure (e.g. can't create a new process).
  5282 int os::fork_and_exec(char* cmd, bool use_vfork_if_available) {
  5331 int os::fork_and_exec(char* cmd, bool use_vfork_if_available) {
  5283   STARTUPINFO si;
  5332   STARTUPINFO si;
  5284   PROCESS_INFORMATION pi;
  5333   PROCESS_INFORMATION pi;