diff options
author | Benoit Germain <bnt.germain@gmail.com> | 2013-03-13 20:48:01 +0100 |
---|---|---|
committer | Benoit Germain <bnt.germain@gmail.com> | 2013-03-13 20:48:01 +0100 |
commit | 8fb8dc1edeceae9fff65463cd80da05d8995fb7f (patch) | |
tree | 290c3e7010d0f5a4674fa29141c0978b045e92c4 /src/lanes.lua | |
parent | 6261eab8d81a6901201cb711283da6281db193ec (diff) | |
download | lanes-8fb8dc1edeceae9fff65463cd80da05d8995fb7f.tar.gz lanes-8fb8dc1edeceae9fff65463cd80da05d8995fb7f.tar.bz2 lanes-8fb8dc1edeceae9fff65463cd80da05d8995fb7f.zip |
version 3.5.2
* stricter validation of with_timers config option: validator was accepting any non-boolean value
* new configuration option protect_allocator for VMs with thread unsafe allocators (such as LuaJIT)
* removed some obsolete bits of dead code
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 | ||