diff options
-rw-r--r-- | src/lanes.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lanes.lua b/src/lanes.lua index 1378412..07792b6 100644 --- a/src/lanes.lua +++ b/src/lanes.lua | |||
@@ -685,7 +685,11 @@ local genlock = function(linda_, key_, N) | |||
685 | local timeout = (mode_ == "try") and 0 or nil | 685 | local timeout = (mode_ == "try") and 0 or nil |
686 | if M_ > 0 then | 686 | if M_ > 0 then |
687 | -- 'nil' timeout allows 'key_' to be numeric | 687 | -- 'nil' timeout allows 'key_' to be numeric |
688 | return linda_:send(timeout, key_, true) -- suspends until been able to push them | 688 | local _status, _err = linda_:send(timeout, key_, true) -- suspends until been able to push them |
689 | -- if success, _status is true, that's what we return | ||
690 | -- if failure, _status is nil, _err contains the error, that's what we return | ||
691 | -- propagate cancel_error if we got it, else return true or false | ||
692 | return (_err == cancel_error and _err) or (_status and true or false) | ||
689 | else | 693 | else |
690 | local _k, _v = linda_:receive(nil, key_) | 694 | local _k, _v = linda_:receive(nil, key_) |
691 | -- propagate cancel_error if we got it, else return true or false | 695 | -- propagate cancel_error if we got it, else return true or false |