aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenoit Germain <benoit.germain@ubisoft.com>2024-05-07 09:23:12 +0200
committerBenoit Germain <benoit.germain@ubisoft.com>2024-05-13 18:15:46 +0200
commitebb0837588336e32fc1258a3838673afdd31ee71 (patch)
treef7590e7d8d22fe62f9022bf6cb1ae442dccc5861 /src
parent2c69c99da47b1d708606da713433608c73ecdb88 (diff)
downloadlanes-ebb0837588336e32fc1258a3838673afdd31ee71.tar.gz
lanes-ebb0837588336e32fc1258a3838673afdd31ee71.tar.bz2
lanes-ebb0837588336e32fc1258a3838673afdd31ee71.zip
API changes
* lanes.sleep accepts 'indefinitely'. * settings.with_timers is false by default
Diffstat (limited to 'src')
-rw-r--r--src/lanes.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lanes.lua b/src/lanes.lua
index f95dddf..caa8818 100644
--- a/src/lanes.lua
+++ b/src/lanes.lua
@@ -71,7 +71,7 @@ local default_params =
71 on_state_create = nil, 71 on_state_create = nil,
72 shutdown_timeout = 0.25, 72 shutdown_timeout = 0.25,
73 shutdown_mode = "hard", 73 shutdown_mode = "hard",
74 with_timers = true, 74 with_timers = false,
75 track_lanes = false, 75 track_lanes = false,
76 demote_full_userdata = nil, 76 demote_full_userdata = nil,
77 verbose_errors = false, 77 verbose_errors = false,
@@ -626,7 +626,9 @@ end
626-- PUBLIC LANES API 626-- PUBLIC LANES API
627local sleep = function(seconds_) 627local sleep = function(seconds_)
628 seconds_ = seconds_ or 0.0 -- this causes false and nil to be a valid input, equivalent to 0.0, but that's ok 628 seconds_ = seconds_ or 0.0 -- this causes false and nil to be a valid input, equivalent to 0.0, but that's ok
629 if type(seconds_) ~= "number" then 629 if seconds_ == 'indefinitely' then
630 seconds_ = nil
631 elseif type(seconds_) ~= "number" then
630 error("invalid duration " .. string_format("%q", tostring(seconds_))) 632 error("invalid duration " .. string_format("%q", tostring(seconds_)))
631 end 633 end
632 -- receive data on a channel no-one ever sends anything, thus blocking for the specified duration 634 -- receive data on a channel no-one ever sends anything, thus blocking for the specified duration