diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2021-02-24 17:43:16 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-03-02 17:29:05 -0500 |
commit | 5d7978df2f23ba125adacbe371188f99debdbb43 (patch) | |
tree | 70e78707f2d145da439d7720df4909f6ca398ae8 | |
parent | e571eda75f979e315ff87997e58ed99eb9d874c9 (diff) | |
download | haskell-5d7978df2f23ba125adacbe371188f99debdbb43.tar.gz |
Define TRY_ACQUIRE_LOCK correctly when non-threaded
-rw-r--r-- | includes/rts/OSThreads.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/includes/rts/OSThreads.h b/includes/rts/OSThreads.h index ed9c0a3b5e..b57799fd55 100644 --- a/includes/rts/OSThreads.h +++ b/includes/rts/OSThreads.h @@ -51,8 +51,8 @@ typedef pthread_key_t ThreadLocalKey; } // Returns zero if the lock was acquired. -EXTERN_INLINE int TRY_ACQUIRE_LOCK(pthread_mutex_t *mutex); -EXTERN_INLINE int TRY_ACQUIRE_LOCK(pthread_mutex_t *mutex) +EXTERN_INLINE int OS_TRY_ACQUIRE_LOCK(pthread_mutex_t *mutex); +EXTERN_INLINE int OS_TRY_ACQUIRE_LOCK(pthread_mutex_t *mutex) { LOCK_DEBUG_BELCH("TRY_ACQUIRE_LOCK", mutex); return pthread_mutex_trylock(mutex); @@ -133,7 +133,7 @@ typedef SRWLOCK Mutex; #else #define OS_ACQUIRE_LOCK(mutex) AcquireSRWLockExclusive(mutex) -#define TRY_ACQUIRE_LOCK(mutex) (TryAcquireSRWLockExclusive(mutex) == 0) +#define OS_TRY_ACQUIRE_LOCK(mutex) (TryAcquireSRWLockExclusive(mutex) == 0) #define OS_RELEASE_LOCK(mutex) ReleaseSRWLockExclusive(mutex) #define OS_INIT_LOCK(mutex) InitializeSRWLock(mutex) #define OS_CLOSE_LOCK(mutex) @@ -200,12 +200,14 @@ void releaseThreadNode (void); #if defined(THREADED_RTS) #define ACQUIRE_LOCK(l) OS_ACQUIRE_LOCK(l) +#define TRY_ACQUIRE_LOCK(l) OS_TRY_ACQUIRE_LOCK(l) #define RELEASE_LOCK(l) OS_RELEASE_LOCK(l) #define ASSERT_LOCK_HELD(l) OS_ASSERT_LOCK_HELD(l) #else #define ACQUIRE_LOCK(l) +#define TRY_ACQUIRE_LOCK(l) 0 #define RELEASE_LOCK(l) #define ASSERT_LOCK_HELD(l) |