]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Changes to a common source file not applicable to open-vm-tools.
authorJohn Wolfe <jwolfe@vmware.com>
Tue, 22 Dec 2020 20:22:03 +0000 (12:22 -0800)
committerJohn Wolfe <jwolfe@vmware.com>
Tue, 22 Dec 2020 20:22:03 +0000 (12:22 -0800)
open-vm-tools/lib/lock/ulSema.c

index aabb087ccd292f1ee45d166b14b31366fab2716f..f0984a19c8bf063d312073453fc5b8c068ea7b0c 100644 (file)
@@ -118,54 +118,48 @@ MXUserTimedDown(NativeSemaphore *sema,  // IN:
                 uint64 waitTimeNS,      // IN:
                 Bool *downOccurred)     // OUT:
 {
-    int err;
-    DWORD status;
-    const uint64 maxWaitTimeMS = (uint64) 0x7FFFFFFF;
-    uint64 waitTimeMS = CEILING(waitTimeNS, (uint64) MXUSER_A_MILLION);
-
-    if (waitTimeMS > maxWaitTimeMS) {
-       waitTimeMS = maxWaitTimeMS;
-    }
-
-    status = WaitForSingleObject(*sema, (int) waitTimeMS);
-
-    switch (status) {
-       case WAIT_OBJECT_0:  // The down (decrement) occurred
-          *downOccurred = TRUE;
-          err = 0;
-          break;
-
-       case WAIT_TIMEOUT:  // Timed out; the down (decrement) did not occur
-          *downOccurred = FALSE;
-          err = 0;
-          break;
-
-       default:  // Something really terrible has happened...
-          Panic("%s: WaitForSingleObject return value %x\n",
-                __FUNCTION__, status);
-    }
-
-    return err;
+   int err;
+   DWORD status;
+   const uint64 maxWaitTimeMS = (uint64) 0x7FFFFFFF;
+   uint64 waitTimeMS = CEILING(waitTimeNS, (uint64) MXUSER_A_MILLION);
+
+   if (waitTimeMS > maxWaitTimeMS) {
+      waitTimeMS = maxWaitTimeMS;
+   }
+
+   status = WaitForSingleObject(*sema, (DWORD) waitTimeMS);
+
+   switch (status) {
+      case WAIT_OBJECT_0:  // The down (decrement) occurred
+         *downOccurred = TRUE;
+         err = 0;
+         break;
+
+      case WAIT_TIMEOUT:  // Timed out; the down (decrement) did not occur
+         *downOccurred = FALSE;
+         err = 0;
+         break;
+
+      default:  // Something really terrible has happened...
+         Panic("%s: WaitForSingleObject return value %x\n",
+               __FUNCTION__, status);
+   }
+
+   return err;
 }
 
 static int
 MXUserDown(NativeSemaphore *sema)  // IN:
 {
-   int err;
-   Bool downOccurred;
+   DWORD status = WaitForSingleObject(*sema, INFINITE);
 
-   /*
-    * Use an infinite timed wait to implement down. If the timed down
-    * succeeds, assert that the down actually occurred.
-    */
-
-   err = MXUserTimedDown(sema, INFINITE, &downOccurred);
-
-   if (err == 0) {
-      ASSERT(downOccurred);
+   /* The down (decrement) *HAD BETTER HAVE* occurred */
+   if (status != WAIT_OBJECT_0) {
+      Panic("%s: WaitForSingleObject return value %x\n",
+            __FUNCTION__, status);
    }
 
-   return err;
+   return 0;
 }
 
 static int