diff options
author | Benoit Germain <bnt.germain@gmail.com> | 2022-02-21 11:30:51 +0100 |
---|---|---|
committer | Benoit Germain <bnt.germain@gmail.com> | 2022-02-21 11:30:51 +0100 |
commit | baf5414b853524bb20df2b92e4b4e13bb1e425cd (patch) | |
tree | f66565c529558cbc7a23cfd6e503193c8f5e7b9d /src/lanes.lua | |
parent | a147fa3aaf2a60252bd9cfd609ee7b65725d0ce8 (diff) | |
download | lanes-baf5414b853524bb20df2b92e4b4e13bb1e425cd.tar.gz lanes-baf5414b853524bb20df2b92e4b4e13bb1e425cd.tar.bz2 lanes-baf5414b853524bb20df2b92e4b4e13bb1e425cd.zip |
Make allocator threadsafe by default when running LuaJIT, because LuaJIT allocator is not
Diffstat (limited to 'src/lanes.lua')
-rw-r--r-- | src/lanes.lua | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lanes.lua b/src/lanes.lua index 2f06137..0858ad7 100644 --- a/src/lanes.lua +++ b/src/lanes.lua | |||
@@ -76,7 +76,8 @@ lanes.configure = function( settings_) | |||
76 | track_lanes = false, | 76 | track_lanes = false, |
77 | demote_full_userdata = nil, | 77 | demote_full_userdata = nil, |
78 | verbose_errors = false, | 78 | verbose_errors = false, |
79 | allocator = nil | 79 | -- LuaJIT provides a thread-unsafe allocator by default, so we need to protect it when used in parallel lanes |
80 | allocator = (package.loaded.jit and jit.version) and "protected" or nil | ||
80 | } | 81 | } |
81 | local boolean_param_checker = function( val_) | 82 | local boolean_param_checker = function( val_) |
82 | -- non-'boolean-false' should be 'boolean-true' or nil | 83 | -- non-'boolean-false' should be 'boolean-true' or nil |