summaryrefslogtreecommitdiff
path: root/src/threading/thread.cpp
Commit message (Collapse)AuthorAge
* Fix synchronization issue at thread startsfan52022-05-02
| | | | | | | | | | If a newly started thread immediately exits then m_running would immediately be set to false again and the caller would be stuck waiting for m_running to become true forever. Since a mutex for synchronizing startup already exists we can simply move the while loop into it. see also: #5134 which introduced m_start_finished_mutex
* Remove Thread::kill() and related unittest (#10317)Sebastien Marie2020-09-10
| | | | Closes: #6065
* Add NetBSD cpu affinity support code (#10378)David CARLIER2020-09-09
|
* NetBSD build fix proposal. (#10308)David CARLIER2020-08-25
| | | Fixing thread naming call and let the class setting RANDOM_MIN/RANDOM_MAX.
* Complete Haiku platform support. (#10311)David CARLIER2020-08-23
| | | | | Fixing linkage/libraries missing issue. Implements missing platform specifics.
* DragonFly BSD is somewhat identical to FreeBSD (#8159)Leonid Bobrov2019-02-03
|
* Thread: fix a crash on Windows due to data race condition on ↵Loïc Blot2017-10-10
| | | | Thread::m_start_finished_mutex (#6515)
* Fix msvc annoyances (#5963)adrido2017-06-27
| | | | | | | | | | | | | | | | | | | | * MSVC: Fix '/std:c++11' is not a valid compiler option * MSVC/MINGW: Define 'WIN32_LEAN_AND_MEAN' for the whole project In some obscure cases 'Windows.h" got includet before that definition, which leaded to compilation warnings+errors * MSVC: '/arch:SSE' is only available for x86 * MSVC: Fix float conversation * MSVC/MINGW: use winthreads on Windows * MSVC: 'USE_CMAKE_CONFIG' might be already definied by CMake build system * MSVC: Use all available cpu cores for compiling * Add missing include ctime and use std::time_t
* C++11 cleanup on constructors (#6000)Vincent Glize2017-06-19
| | | | * C++11 cleanup on constructors dir script
* Remove threads.h and replace its definitions with their C++11 equivalents ↵ShadowNinja2017-06-11
| | | | | | (#5957) This also changes threadProc's signature, since C++11 supports arbitrary thread function signatures.
* C++11 patchset 5: use std::threads and remove old compat layer (#5928)Loïc Blot2017-06-08
| | | | | | | * C++11 patchset 5: use std::threads and remove old compat layer * use pragma once in modified headers * use C++11 function delete for object copy
* Fix AIX threading buildShadowNinja2017-01-28
|
* Fix synchronization issue at thread startShadowNinja2017-01-28
| | | | | | | | | | | | | | | | 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.
* Fix C++11 Windows build of threading codesfan52016-10-06
| | | | | | | The initial problem was that mutex_auto_lock.h tries to use std::unique_lock<std::mutex> despite mutex.h not using C++11's std::mutex on Windows. The problem here is the mismatch between C++11 usage conditions of the two headers. This commit moves the decision logic to threads.h and makes sure mutex.h, mutex_auto_lock.h and event.h all use the same features.
* Fix & make linux conditionals uniform (#4278)Rogier-52016-07-04
| | | | | | | | The source used a hodge-podge of different combinations of different macros to check for linux: 'linux', '__linux', '__linux__'. As '__linux__' is standard (Posix), and the others are not, the source now uniformly uses __linux__. If either linux or __linux are defined, it is made sure that __linux__ is defined as well.
* Fix POSIX C++11 buildShadowNinja2016-04-30
| | | | I broke this in 46fd114e9a4e05b74576dce682e24357363298e7.
* Fix race on thread creationShadowNinja2016-04-28
| | | | This often broke the threading tests on OSX.
* Fix misc. MinGW and Valgrind warningskwolekr2015-11-08
|
* Fix C++11 compatibilitykwolekr2015-10-31
|
* Fix some threading things and add additional thread unittestskwolekr2015-10-24
| | | | | | - Fix thread name reset on start() - Fully reset thread state on kill() - Add unittests to check for correct object states under various circumstances
* Fix == to =Rui2015-10-17
|
* Refactor Thread class to improve readability and portabilitykwolekr2015-10-16
| | | | | | | | | - Fix some incompatibilities with obscure platforms (AIX and WinCE) - Clean up Thread class interface - Add m_ prefix to private member variables - Simplify platform-dependent logic, reducing preprocessor conditional clauses and improving readibility - Add Thread class documentation
* Refactor loggingShadowNinja2015-10-14
| | | | | | | | | - Add warning log level - Change debug_log_level setting to enumeration string - Map Irrlicht log events to MT log events - Encapsulate log_* functions and global variables into a class, Logger - Unify dstream with standard logging mechanism - Unify core.debug() with standard core.log() script API
* Fix building on OSX, broken since "Clean up threading"Pavel Puchkin2015-09-06
| | | | | | | | | | | | Commit e4bff8be94c0db4f94e63ad448d0eeb869ccdbbd - Clean up threading by @ShadowNinja has broken the OSX build. Including things inside a namespace isn't good. Also fixes #3124.
* Clean up threadingShadowNinja2015-08-23
* Rename everything. * Strip J prefix. * Change UpperCamelCase functions to lowerCamelCase. * Remove global (!) semaphore count mutex on OSX. * Remove semaphore count getter (unused, unsafe, depended on internal API functions on Windows, and used a hack on OSX). * Add `Atomic<type>`. * Make `Thread` handle thread names. * Add support for C++11 multi-threading. * Combine pthread and win32 sources. * Remove `ThreadStarted` (unused, unneeded). * Move some includes from the headers to the sources. * Move all of `Event` into its header (allows inlining with no new includes). * Make `Event` use `Semaphore` (except on Windows). * Move some porting functions into `Thread`. * Integrate logging with `Thread`. * Add threading test.