mirror of
https://github.com/minetest/minetest.git
synced 2024-11-30 19:43:45 +01:00
c93f7f5cea
If a newly spawned thread called getThreadId or getThreadHandle before the spawning thread finished saving the thread handle, then the handle/id would be used uninitialized. This would cause the threading tests to fail since isCurrentThread would return false, and if Minetest is built with C++11 support the std::thread object pointer would be dereferenced while ininitialized, causing a segmentation fault. This fixes the issue by using a mutex to force the spawned thread to wait for the spawning thread to finish initializing the thread object. An alternative way to handle this would be to also set the thread handle/id in the started thread but this wouldn't work for C++11 builds because there's no way to get the partially constructed object. |
||
---|---|---|
.. | ||
CMakeLists.txt | ||
test_areastore.cpp | ||
test_collision.cpp | ||
test_compression.cpp | ||
test_connection.cpp | ||
test_filepath.cpp | ||
test_inventory.cpp | ||
test_keycode.cpp | ||
test_map_settings_manager.cpp | ||
test_mapnode.cpp | ||
test_nodedef.cpp | ||
test_noderesolver.cpp | ||
test_noise.cpp | ||
test_objdef.cpp | ||
test_player.cpp | ||
test_profiler.cpp | ||
test_random.cpp | ||
test_schematic.cpp | ||
test_serialization.cpp | ||
test_settings.cpp | ||
test_socket.cpp | ||
test_threading.cpp | ||
test_utilities.cpp | ||
test_voxelalgorithms.cpp | ||
test_voxelmanipulator.cpp | ||
test.cpp | ||
test.h |