diff options
author | Simon Marlow <marlowsd@gmail.com> | 2016-09-15 11:34:05 +0100 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2016-09-15 13:23:36 +0100 |
commit | 912384535d2ac7452d3bcda34cdee238e30600c9 (patch) | |
tree | cf6578809c8caf1fb6820c6ec1fac8dd0cb0258a /rts/Capability.c | |
parent | 86836a2ecc089b917866a2cb65b716fd5f04cc56 (diff) | |
download | haskell-912384535d2ac7452d3bcda34cdee238e30600c9.tar.gz |
tryGrabCapability should be using TRY_ACQUIRE_LOCK
Diffstat (limited to 'rts/Capability.c')
-rw-r--r-- | rts/Capability.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/rts/Capability.c b/rts/Capability.c index 6979c637bc..6ca34f8660 100644 --- a/rts/Capability.c +++ b/rts/Capability.c @@ -973,8 +973,10 @@ prodCapability (Capability *cap, Task *task) rtsBool tryGrabCapability (Capability *cap, Task *task) { + int r; if (cap->running_task != NULL) return rtsFalse; - ACQUIRE_LOCK(&cap->lock); + r = TRY_ACQUIRE_LOCK(&cap->lock); + if (r != 0) return rtsFalse; if (cap->running_task != NULL) { RELEASE_LOCK(&cap->lock); return rtsFalse; |