Releases: LuaLanes/lanes
Releases · LuaLanes/lanes
version 4.0.0
Changes from 3.17.2:
- Internal changes
- Lanes is implemented in C++20: thread, condition_variable, mutex, string_view, variant, lambdas, templates, and more!
- Almost all platform-specific code is gone (only a small bit for thread priority and affinity remains).
- Decoda support inactive by default.
- Deep userdata interface fully revamped to C++20 too.
- Supports Lua 5.5- Lanes API changes
- Lanes module:
- shared library is now lanes_core.[so|dll] instead of lanes/core.[so|dll]
- lanes.register() is also available as lanes_register() in the exported C API.
- lanes.sleep(): passing nil or no argument now blocks indefinitely (until cancellation is received).
- function set_debug_threadname() available inside a Lane is renamed lane_threadname(); can now both read and write the name.
- function cancel_test() raises cancel_error by default in a hard-cancelled lane.
- new function lanes.finally(). Installs a function that gets called at Lanes shutdown after attempting to terminate all lanes.
If some lanes still run after the finalizer, Universe::__gc with raise an error or freeze, depending on its return value. - new function lanes.collectgarbage(), to force a full GC cycle in the keeper states.
- new function lanes.thread_priority_range(), to query the valid range of priorities.
- Configuration settings:
- Boolean parameters only accept boolean values.
- allocator provider function is called with a string hint to distinguish internal allocations, lane and keeper states.
- demote_full_userdata removed. Use __lanesconvert instead (see below).
- keepers_gc_threshold added. Controls when GC runs inside keepers.
- nb_keepers changed to nb_user_keepers. limited to 100 keepers on top of the internal keeper used by the timer Linda.
- strip_functions added. Only useful for Lua 5.3+.
- verbose_errors removed. Use lane error_trace_level instead.
- with_timers is false by default.
- Non-deep full userdata are processed during module registration just like ordinary module C functions, making them valid transferable (up)values (for example: io.stdin).
- thread API errors cause a Lua error instead of aborting the program.
- thread priorities can now be set using the native range of values, if desired.
- Lanes:
- Can no longer be "killed" by hard-stopping their thread without any resource cleanup (see lane:cancel()).
- lanes.gen() settings:
- stricter check of base libraries (can raise an error if it doesn't exist in the Lua flavor it's built against).
- error_trace_level added. Replaces the global verbose_errors setting.
- name added. Can be used to set the name early (before the lane body calls lane_threadname()).
- New generator lanes.coro() to start a lane as a coroutine.
- New __close metamethod that calls join().
- lane:join() returns nil, error in case of problem, else returns true followed by the lane body return values.
- lane:get_debug_threadname() renamed get_threadname().
- cancel_test() returns "soft"/"hard" instead of true when a cancellation request is active.
- Lindas:
- lanes.linda()
- Arguments can be provided in any order.
- Accepts a callback to be invoked by __close (see below).
- Providing "auto" as name when constructing a Linda cause Lanes to provide a name built from the source location of the construction.
- Specifying a group to lanes.linda() is mandatory when Lanes is configured with user Keepers.
- linda:deep() result no longer contains the raw C pointer of the Linda object.
- new function linda:receive_batched() to replace linda:receive(linda.batched). linda.batched special value is removed.
- linda :receive(), :send(), :get(), :set(), :limit() return nil, error in case of problem. Returned values in case of success change too.
- linda:limit() can be used to read the value if no new limit is provided.
- linda:restrict() can restrain the use of send/receive or set/get on any key.
- New __close metamethod that calls any suitable handler that was provided at Linda creation.
- linda:dump() outputs .limit as 'unlimited' instead of -1 for unlimited keys.
- linda:wake() can wake up threads waiting for a Linda without doing any I/O on it.
- linda.status reads the cancel status of the Linda.
- new function linda:collectgarbage() to force collection of all stale data in the associated keeper.
- Deep userdata are an acceptable slot to send data into (for example, another linda).
- Tables can be used as table keys in transferred data.
- lanes.linda()
- Full userdata conversion:
- __lanesconvert added.
- global configuration convert_fallback and convert_max_attempts added.
- __lanesignore removed. Use __lanesconvert instead.
- Lanes module:
- Lanes API changes
version 3.17.2
Fix a clang linker error
version 3.17.1
Just a compilation warning fix
version 3.17.0
- add manual control over GC behavior in keeper states
- update a bunch of test scripts
- minor internal fixes
- probably the last C implementation update, unless a critical bug creeps up
- expose nil sentinel as lanes.null
version 3.16.3
- naive luajit detection in PUC-Lua-based builds, and vice-versa to detect mismatches
version 3.16.2
- Prevent crash on linux as non-root
version 3.16.1
- provide user control over the allocator used by Lanes to manage internal allocations (can either reuse the allocator from the master Lua state or force libc functions).
- a Lane thread no longer forces its priority unless an explicit value is provided by the generator.
version 3.16.0
- fix require() wrapper to return all values returned by original require()
- Lanes no longer relies on malloc/free for internal allocations, but uses the primary alloc function from the master Lua state (excepted for LuaJIT flavors, because the allocator seems to assume that it won't be used oustide the Lua state).
- __lanesclone is now called only once with 3 parameters dest, source, size -> BREAKS CUSTOM DEEP USERDATA API
version 3.15.1
Fix Lanes not working with Lua 5.4 due to changes in the way luaL_buffer is working compared to previous versions of Lua.
version 3.15
- a bunch of code cleanup.
- some build fixes pull from external contributors working on platforms I don't have access to.
- fixed set_tread_affinity.
- changed lanes.threads() output so that several lanes with the same name don't clobber each other in the result table
- __lanesclone now receives the original as light userdata the first time it is called
- correctly transfer the uservalue of a deep userdata
- fix stack overflow when transfering a clonable userdata referencing itself through a uservalue.
- fixed some unit tests.