diff options
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; |