rts: Use always-available locking operations in pthread Itimer implementation
authorBen Gamari <ben@smart-cactus.org>
Wed, 9 Jan 2019 14:17:05 +0000 (09:17 -0500)
committerBen Gamari <ben@smart-cactus.org>
Mon, 28 Jan 2019 23:07:38 +0000 (18:07 -0500)
Previously we ACQUIRE_LOCK and RELEASE_LOCK but these compile to a noop in the
non-threaded RTS, as noted in #16150. Use OS_ACQUIRE_LOCK and OS_RELEASE_LOCK
instead.

(cherry picked from commit ce11f6f25c1160262830d9670c4eaaebac37cbaf)

rts/posix/itimer/Pthread.c

index 90923c6..6cc211b 100644 (file)
@@ -134,12 +134,12 @@ static void *itimer_thread_func(void *_handle_tick)
 
         // first try a cheap test
         if (stopped) {
-            ACQUIRE_LOCK(&mutex);
+            OS_ACQUIRE_LOCK(&mutex);
             // should we really stop?
             if (stopped) {
                 waitCondition(&start_cond, &mutex);
             }
-            RELEASE_LOCK(&mutex);
+            OS_RELEASE_LOCK(&mutex);
         } else {
             handle_tick(0);
         }
@@ -176,19 +176,19 @@ initTicker (Time interval, TickProc handle_tick)
 void
 startTicker(void)
 {
-    ACQUIRE_LOCK(&mutex);
+    OS_ACQUIRE_LOCK(&mutex);
     stopped = 0;
     signalCondition(&start_cond);
-    RELEASE_LOCK(&mutex);
+    OS_RELEASE_LOCK(&mutex);
 }
 
 /* There may be at most one additional tick fired after a call to this */
 void
 stopTicker(void)
 {
-    ACQUIRE_LOCK(&mutex);
+    OS_ACQUIRE_LOCK(&mutex);
     stopped = 1;
-    RELEASE_LOCK(&mutex);
+    OS_RELEASE_LOCK(&mutex);
 }
 
 /* There may be at most one additional tick fired after a call to this */