diff options
Diffstat (limited to 'src/lanes.lua')
-rw-r--r-- | src/lanes.lua | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/lanes.lua b/src/lanes.lua index 8a2592b..f95dddf 100644 --- a/src/lanes.lua +++ b/src/lanes.lua | |||
@@ -208,25 +208,29 @@ end | |||
208 | 208 | ||
209 | local opt_validators = | 209 | local opt_validators = |
210 | { | 210 | { |
211 | priority = function(v_) | 211 | gc_cb = function(v_) |
212 | local tv = type(v_) | 212 | local tv = type(v_) |
213 | return (tv == "number") and v_ or raise_option_error("priority", tv, v_) | 213 | return (tv == "function") and v_ or raise_option_error("gc_cb", tv, v_) |
214 | end, | 214 | end, |
215 | globals = function(v_) | 215 | globals = function(v_) |
216 | local tv = type(v_) | 216 | local tv = type(v_) |
217 | return (tv == "table") and v_ or raise_option_error("globals", tv, v_) | 217 | return (tv == "table") and v_ or raise_option_error("globals", tv, v_) |
218 | end, | 218 | end, |
219 | name = function(v_) | ||
220 | local tv = type(v_) | ||
221 | return (tv == "string") and v_ or raise_option_error("name", tv, v_) | ||
222 | end, | ||
219 | package = function(v_) | 223 | package = function(v_) |
220 | local tv = type(v_) | 224 | local tv = type(v_) |
221 | return (tv == "table") and v_ or raise_option_error("package", tv, v_) | 225 | return (tv == "table") and v_ or raise_option_error("package", tv, v_) |
222 | end, | 226 | end, |
223 | required = function(v_) | 227 | priority = function(v_) |
224 | local tv = type(v_) | 228 | local tv = type(v_) |
225 | return (tv == "table") and v_ or raise_option_error("required", tv, v_) | 229 | return (tv == "number") and v_ or raise_option_error("priority", tv, v_) |
226 | end, | 230 | end, |
227 | gc_cb = function(v_) | 231 | required = function(v_) |
228 | local tv = type(v_) | 232 | local tv = type(v_) |
229 | return (tv == "function") and v_ or raise_option_error("gc_cb", tv, v_) | 233 | return (tv == "table") and v_ or raise_option_error("required", tv, v_) |
230 | end | 234 | end |
231 | } | 235 | } |
232 | 236 | ||
@@ -338,10 +342,10 @@ local gen = function(...) | |||
338 | end | 342 | end |
339 | 343 | ||
340 | local core_lane_new = assert(core.lane_new) | 344 | local core_lane_new = assert(core.lane_new) |
341 | local priority, globals, package, required, gc_cb = opt.priority, opt.globals, opt.package or package, opt.required, opt.gc_cb | 345 | local priority, globals, package, required, gc_cb, name = opt.priority, opt.globals, opt.package or package, opt.required, opt.gc_cb, opt.name |
342 | return function(...) | 346 | return function(...) |
343 | -- must pass functions args last else they will be truncated to the first one | 347 | -- must pass functions args last else they will be truncated to the first one |
344 | return core_lane_new(func, libs, priority, globals, package, required, gc_cb, ...) | 348 | return core_lane_new(func, libs, priority, globals, package, required, gc_cb, name, ...) |
345 | end | 349 | end |
346 | end -- gen() | 350 | end -- gen() |
347 | 351 | ||
@@ -569,7 +573,7 @@ local configure_timers = function() | |||
569 | end | 573 | end |
570 | end | 574 | end |
571 | end -- timer_body() | 575 | end -- timer_body() |
572 | timer_lane = gen("*", { package= {}, priority = core.max_prio}, timer_body)() -- "*" instead of "io,package" for LuaJIT compatibility... | 576 | timer_lane = gen("*", { package= {}, priority = core.max_prio, name = "LanesTimer"}, timer_body)() -- "*" instead of "io,package" for LuaJIT compatibility... |
573 | end -- first_time | 577 | end -- first_time |
574 | 578 | ||
575 | ----- | 579 | ----- |