diff options
author | Benoit Germain <benoit.germain@ubisoft.com> | 2025-04-28 17:59:09 +0200 |
---|---|---|
committer | Benoit Germain <benoit.germain@ubisoft.com> | 2025-04-28 17:59:09 +0200 |
commit | 58b44326ad2aaae710797745b800c61f65725ebb (patch) | |
tree | e153423637823403f162023787a11d3c9ddded41 | |
parent | a86327245eea5638b933aec795026699201c19e1 (diff) | |
download | lanes-58b44326ad2aaae710797745b800c61f65725ebb.tar.gz lanes-58b44326ad2aaae710797745b800c61f65725ebb.tar.bz2 lanes-58b44326ad2aaae710797745b800c61f65725ebb.zip |
Remove a useless mutex guard on lane setf-destruct
-rw-r--r-- | src/allocator.hpp | 2 | ||||
-rw-r--r-- | src/lane.cpp | 2 | ||||
-rw-r--r-- | unit_tests/init_and_shutdown.cpp | 1 |
3 files changed, 3 insertions, 2 deletions
diff --git a/src/allocator.hpp b/src/allocator.hpp index c073391..ce65a4b 100644 --- a/src/allocator.hpp +++ b/src/allocator.hpp | |||
@@ -33,6 +33,8 @@ namespace lanes { | |||
33 | // can't actually delete the operator because the compiler generates stack unwinding code that could call it in case of exception | 33 | // can't actually delete the operator because the compiler generates stack unwinding code that could call it in case of exception |
34 | static void operator delete([[maybe_unused]] void* const p_, [[maybe_unused]] lua_State* const L_) {} | 34 | static void operator delete([[maybe_unused]] void* const p_, [[maybe_unused]] lua_State* const L_) {} |
35 | 35 | ||
36 | ~AllocatorDefinition() = default; | ||
37 | |||
36 | AllocatorDefinition(lua_Alloc const allocF_, void* const allocUD_) noexcept | 38 | AllocatorDefinition(lua_Alloc const allocF_, void* const allocUD_) noexcept |
37 | : allocF{ allocF_ } | 39 | : allocF{ allocF_ } |
38 | , allocUD{ allocUD_ } | 40 | , allocUD{ allocUD_ } |
diff --git a/src/lane.cpp b/src/lane.cpp index e6ea2e5..26ddebd 100644 --- a/src/lane.cpp +++ b/src/lane.cpp | |||
@@ -786,10 +786,8 @@ static void lane_main(Lane* const lane_) | |||
786 | 786 | ||
787 | // let's try not to crash if the lane didn't terminate gracefully and the Universe met its end | 787 | // let's try not to crash if the lane didn't terminate gracefully and the Universe met its end |
788 | if (!lane_->flaggedAfterUniverseGC.load(std::memory_order_relaxed)) { | 788 | if (!lane_->flaggedAfterUniverseGC.load(std::memory_order_relaxed)) { |
789 | lane_->U->selfdestructMutex.lock(); | ||
790 | // done with lua_close(), terminal shutdown sequence may proceed | 789 | // done with lua_close(), terminal shutdown sequence may proceed |
791 | lane_->U->selfdestructingCount.fetch_sub(1, std::memory_order_release); | 790 | lane_->U->selfdestructingCount.fetch_sub(1, std::memory_order_release); |
792 | lane_->U->selfdestructMutex.unlock(); | ||
793 | } | 791 | } |
794 | 792 | ||
795 | // we destroy ourselves, therefore our thread member too, from inside the thread body | 793 | // we destroy ourselves, therefore our thread member too, from inside the thread body |
diff --git a/unit_tests/init_and_shutdown.cpp b/unit_tests/init_and_shutdown.cpp index bd72157..764e294 100644 --- a/unit_tests/init_and_shutdown.cpp +++ b/unit_tests/init_and_shutdown.cpp | |||
@@ -117,6 +117,7 @@ TEST_CASE("lanes.configure.allocator") | |||
117 | SECTION("allocator = 'protected'") | 117 | SECTION("allocator = 'protected'") |
118 | { | 118 | { |
119 | // no typo, should work | 119 | // no typo, should work |
120 | // TODO: Investigate why this test crashes when unloading lanes_core.dll when running against Lua 5.1 and Lua 5.2 RELEASE ONLY! | ||
120 | L.requireSuccess("require 'lanes'.configure{allocator = 'protected'}"); | 121 | L.requireSuccess("require 'lanes'.configure{allocator = 'protected'}"); |
121 | } | 122 | } |
122 | 123 | ||