diff options
Diffstat (limited to 'src/lanes.lua')
-rw-r--r-- | src/lanes.lua | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/lanes.lua b/src/lanes.lua index c1c641a..c02281d 100644 --- a/src/lanes.lua +++ b/src/lanes.lua | |||
@@ -62,7 +62,7 @@ lanes.configure = function( _params) | |||
62 | local tostring = assert( tostring) | 62 | local tostring = assert( tostring) |
63 | local error = assert( error) | 63 | local error = assert( error) |
64 | 64 | ||
65 | local default_params = { nb_keepers = 1, on_state_create = nil, shutdown_timeout = 0.25, with_timers = true, track_lanes = nil} | 65 | local default_params = { nb_keepers = 1, on_state_create = nil, shutdown_timeout = 0.25, with_timers = true, track_lanes = nil, protect_allocator = false} |
66 | local param_checkers = | 66 | local param_checkers = |
67 | { | 67 | { |
68 | nb_keepers = function( _val) | 68 | nb_keepers = function( _val) |
@@ -77,6 +77,14 @@ lanes.configure = function( _params) | |||
77 | return true -- _val is either false or nil | 77 | return true -- _val is either false or nil |
78 | end | 78 | end |
79 | end, | 79 | end, |
80 | protect_allocator = function( _val) | ||
81 | -- protect_allocator may be nil or boolean | ||
82 | if _val then | ||
83 | return type( _val) == "boolean" | ||
84 | else | ||
85 | return true -- _val is either false or nil | ||
86 | end | ||
87 | end, | ||
80 | on_state_create = function( _val) | 88 | on_state_create = function( _val) |
81 | -- on_state_create may be nil or a function | 89 | -- on_state_create may be nil or a function |
82 | return _val and type( _val) == "function" or true | 90 | return _val and type( _val) == "function" or true |
@@ -121,7 +129,7 @@ lanes.configure = function( _params) | |||
121 | assert( type( core)=="table") | 129 | assert( type( core)=="table") |
122 | 130 | ||
123 | -- configure() is available only the first time lanes.core is required process-wide, and we *must* call it to have the other functions in the interface | 131 | -- configure() is available only the first time lanes.core is required process-wide, and we *must* call it to have the other functions in the interface |
124 | if core.configure then core.configure( _params.nb_keepers, _params.on_state_create, _params.shutdown_timeout, _params.track_lanes) end | 132 | if core.configure then core.configure( _params.nb_keepers, _params.on_state_create, _params.shutdown_timeout, _params.track_lanes, _params.protect_allocator) end |
125 | 133 | ||
126 | local thread_new = assert( core.thread_new) | 134 | local thread_new = assert( core.thread_new) |
127 | 135 | ||