summaryrefslogtreecommitdiff
path: root/src/thread.h
AgeCommit message (Collapse)Author
2021-06-17Fix: on startup, NewGRF scan could case race-condition (#9382)Patric Stout
Creating a thread was not thread-safe. The irony. The video-driver has a function GameLoopPause() which first checks if the thread is the game-thread or not. For this it needs access to this->game_thread. This variable is set in StartNewThread(). However, due to timing, it is well possible GameLoopPause() is called from the thread well before this->game_thread is assigned. And so we have a race-condition! Simply solve this by preventing a thread to start till we are done with our bookkeeping.
2021-06-13Codechange: convert printf DEBUG statements to fmt Debug statementsrubidium42
2021-03-13Fix #8860: [Win32] Crashlog window wasn't reliably shown for crashes not on ↵Michael Lutz
the main thread.
2021-03-10Add: make modal windows update more smoothPatric Stout
Basically, modal windows had their own thread-locking for what drawing was possible. This is a bit nonsense now we have a game-thread. And it makes much more sense to do things like NewGRFScan and GenerateWorld in the game-thread, and not in a thread next to the game-thread. This commit changes that: it removes the threads for NewGRFScan and GenerateWorld, and just runs the code in the game-thread. On regular intervals it allows the draw-thread to do a tick, which gives a much smoother look and feel. It does slow down NewGRFScan and GenerateWorld ever so slightly as it spends more time on drawing. But the slowdown is not measureable on my machines (with 700+ NewGRFs / 4kx4k map and a Debug build). Running without a game-thread means NewGRFScan and GenerateWorld are now blocking.
2019-11-10Cleanup: Removed SVN headersS. D. Cloudt
2019-04-10Codechange: Use null pointer literal instead of the NULL macroHenry Wilson
2019-04-06Codechange: C++11 STL has a function for getting the number of CPU cores.Michael Lutz
2019-04-06Codechange: Use platform independent C++11 function for sleeping on a thread.Michael Lutz
2019-04-06Codechange: Replace custom thread code with C++11 thread objects.Michael Lutz
We assume a conforming C++11 compiler environment that has a valid <thread>-header. Failure to run a real thread is handled gracefully.
2009-09-01(svn r17339) -Codechange: move thread related files to their own directory ↵rubidium
(like done for video, music, sound, etc)
2009-08-21(svn r17248) -Fix: add GPL license notice where appropriaterubidium
2009-01-20(svn r15159) -Fix: move the UDP queries that resolve a hostname into threads ↵rubidium
so they don't freeze OpenTTD when for example the network connection got severed. Thanks to glx for writing the mutex implementation for Windows.
2009-01-20(svn r15158) -Cleanup: remove some unused/unneeded cruft from the thread ↵rubidium
generalisation.
2009-01-12(svn r15006) -Codechange: throw a real instance of a class, instead of '0' ↵truebrain
(which can also be a throw from within a thread for what ever reason)
2008-06-08(svn r13417) -Fix (r12945, r13413): freeing the ThreadObjects in a manner ↵rubidium
that hopefully doesn't cause crashes.
2008-06-08(svn r13412) -Add: OTTDThreadTerminateFunc, for all thread systems, which is ↵truebrain
called when a thread is terminated. Now GenWorld- and SaveLoad-thread cleanup theirselves correctly, while Fibers don't (as that causes access-violations)
2008-06-08(svn r13411) -Codechange: remove the return value from the thread procs ↵rubidium
because it is never used.
2008-05-06(svn r12971) -Documentation: add @file in files that missed them and add ↵rubidium
something more than whitespace as description of files that don't have a description.
2008-04-14(svn r12706) -Merge: the thread rewrite from NoAI. The rewrite makes the ↵rubidium
threading we have better extendable.
2007-07-24(svn r10673) -Cleanup: some assorted style cleanups. Primarily type* var -> ↵rubidium
type *var.
2007-04-04(svn r9558) -Documentation: doxygen and comment changes: 'T' now. Almost donebelugas
2007-03-07(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};rubidium
2007-03-07(svn r9050) -Codechange: Foo(void) -> Foo()rubidium
2007-01-02(svn r7759) -Merge: makefile rewrite. This merge features:rubidium
- A proper ./configure, so everything needs to be configured only once, not for every make. - Usage of makedepend when available. This greatly reduces the time needed for generating the dependencies. - A generator for all project files. There is a single file with sources, which is used to generate Makefiles and the project files for MSVC. - Proper support for OSX universal binaries. - Object files for non-MSVC compiles are also placed in separate directories, making is faster to switch between debug and release compiles and it does not touch the directory with the source files. - Functionality to make a bundle of all needed files for for example a nightly or distribution of a binary with all needed GRFs and language files. Note: as this merge moves almost all files, it is recommended to make a backup of your working copy before updating your working copy.