[commit: ghc] wip/T16150: rts: Use always-available locking operations in pthread Itimer implementation (37a7a83)

git at git.haskell.org git at git.haskell.org
Wed Jan 9 21:36:28 UTC 2019


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/T16150
Link       : http://ghc.haskell.org/trac/ghc/changeset/37a7a83772a643c307c06cfaba8c98e943d06fd1/ghc

>---------------------------------------------------------------

commit 37a7a83772a643c307c06cfaba8c98e943d06fd1
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Wed Jan 9 09:17:05 2019 -0500

    rts: Use always-available locking operations in pthread Itimer implementation
    
    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.


>---------------------------------------------------------------

37a7a83772a643c307c06cfaba8c98e943d06fd1
 rts/posix/itimer/Pthread.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/rts/posix/itimer/Pthread.c b/rts/posix/itimer/Pthread.c
index 817c40f..6f9cd8f 100644
--- a/rts/posix/itimer/Pthread.c
+++ b/rts/posix/itimer/Pthread.c
@@ -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 */



More information about the ghc-commits mailing list