aboutsummaryrefslogtreecommitdiffstats
path: root/erts/lib_src
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2010-06-01 13:53:07 +0000
committerErlang/OTP <[email protected]>2010-06-01 13:53:07 +0000
commit00c65e1556ac9b70683c01136ee933bbb6d4d84a (patch)
tree64bfa5de6a8410f787d18d0011af3de73a1e86e3 /erts/lib_src
parent0b81970d641577dfbcb7d0ba31090c4e362cf860 (diff)
downloadotp-00c65e1556ac9b70683c01136ee933bbb6d4d84a.tar.gz
otp-00c65e1556ac9b70683c01136ee933bbb6d4d84a.tar.bz2
otp-00c65e1556ac9b70683c01136ee933bbb6d4d84a.zip
OTP-8662 Fix ethr_rwmutex_tryrlock
ethr_rwmutex_tryrlock() acquired and refused to acquire a lock with inverted logic. The lock was however never acquired in a thread unsafe manner. (Thanks to JR Zhang for noting this issue)
Diffstat (limited to 'erts/lib_src')
-rw-r--r--erts/lib_src/common/ethread.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/erts/lib_src/common/ethread.c b/erts/lib_src/common/ethread.c
index a4ec4c448b..9c88233934 100644
--- a/erts/lib_src/common/ethread.c
+++ b/erts/lib_src/common/ethread.c
@@ -3216,7 +3216,7 @@ ethr_rwmutex_tryrlock(ethr_rwmutex *rwmtx)
res = ethr_mutex_trylock__(&rwmtx->mtx);
if (res != 0)
return res;
- if (!rwmtx->waiting_writers) {
+ if (rwmtx->waiting_writers) {
res = ethr_mutex_unlock__(&rwmtx->mtx);
if (res == 0)
return EBUSY;