hotspot/src/os/solaris/vm/os_solaris.cpp
changeset 25472 381638db28e6
parent 25468 5331df506290
child 25477 7dad9f95fd31
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp	Thu Jul 03 09:16:56 2014 -0700
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp	Thu Jul 03 11:07:51 2014 -0700
@@ -5440,20 +5440,11 @@
   return abstime;
 }
 
-// Test-and-clear _Event, always leaves _Event set to 0, returns immediately.
-// Conceptually TryPark() should be equivalent to park(0).
-
-int os::PlatformEvent::TryPark() {
-  for (;;) {
-    const int v = _Event;
-    guarantee((v == 0) || (v == 1), "invariant");
-    if (Atomic::cmpxchg(0, &_Event, v) == v) return v;
-  }
-}
-
 void os::PlatformEvent::park() {           // AKA: down()
   // Invariant: Only the thread associated with the Event/PlatformEvent
   // may call park().
+  assert(_nParked == 0, "invariant");
+
   int v;
   for (;;) {
       v = _Event;
@@ -5540,8 +5531,7 @@
   //    1 :=> 1
   //   -1 :=> either 0 or 1; must signal target thread
   //          That is, we can safely transition _Event from -1 to either
-  //          0 or 1. Forcing 1 is slightly more efficient for back-to-back
-  //          unpark() calls.
+  //          0 or 1.
   // See also: "Semaphores in Plan 9" by Mullender & Cox
   //
   // Note: Forcing a transition from "-1" to "1" on an unpark() means
@@ -5745,10 +5735,9 @@
 }
 
 void Parker::unpark() {
-  int s, status;
-  status = os::Solaris::mutex_lock(_mutex);
+  int status = os::Solaris::mutex_lock(_mutex);
   assert(status == 0, "invariant");
-  s = _counter;
+  const int s = _counter;
   _counter = 1;
   status = os::Solaris::mutex_unlock(_mutex);
   assert(status == 0, "invariant");