View Issue Details

IDProjectCategoryView StatusLast Update
0005169The Dark ModCodingpublic05.12.2023 01:00
Reporterstgatilov Assigned Tocabalistic  
PrioritynormalSeverityminorReproducibilityN/A
Status assignedResolutionopen 
Product VersionTDM 2.08 
Target VersionTDM 2.13 
Summary0005169: Clean multithreading routines
DescriptionThe current set of multithreading routines are a mess for many reasons:

1) A crazy mix of C++11 threads and Sys_XXX threads (the later ones rely on WinAPI/pthreads depending on platform). In some cases it is very hard to clarify how it works, e.g. I don't know whyWaitForSingleObject breaks std::condition_variable waits. Perhaps better to switch to Sys_XXX threads everywhere? Occasional ports from BFG codebase will introduce these functions anyway, so switching to C++11 is hardly possible.
2) Thread an synchronization objects live in weird places. For instance, the old Async threads live in Sys/Posix, while frontend threads live in ordinary engine code. Some functions uses Sys_Mutex (which are object-based and can be created in any number), while others rely on 4 numbered Sys_CriticalSection-s. I had a feeling that with more multithreading it's better to drop critical section API, but not sure here.
3) Thread termination is a problem. Old threads were terminated using pthread_cancel on Linux, new ones are terminated with separate bool flags. Both ways seem ugly. Also quick_exit was added recently.
TagsNo tags attached.

Relationships

related to 0004408 resolvedduzenko Find a way to run game tics on a background thread 
parent of 0005441 resolvedstgatilov r_useParallelAddModels crashes when the Lightgem is hidden via Gameplay Settings 

Activities

nbohr1more

nbohr1more

14.12.2020 22:25

developer   ~0013136

I know that there was a large number of fixes for this, can this tracker be closed or should it be moved to 2.10?
stgatilov

stgatilov

15.12.2020 02:41

administrator   ~0013137

The described situation has not changed at all.
On the other hand, it would be great to hear Cabalisti's opinion on it.
cabalistic

cabalistic

23.12.2020 13:11

developer   ~0013179

Something to clean up, for sure. Just rather low priority (for me), as it does appear to be working fine right now and is not code that I regularly stumble across.
nbohr1more

nbohr1more

23.12.2020 18:57

developer   ~0013182

Moving to 2.10. Feel free to un-target if there is no further interest to move forward during the 2.10 dev cycle
nbohr1more

nbohr1more

04.10.2021 18:19

developer   ~0014396

Moving to 2.11 cabalistic will not have time to work on this during the 2.10 cycle
nbohr1more

nbohr1more

15.11.2022 00:24

developer   ~0015421

Moving to 2.12

Issue History

Date Modified Username Field Change
05.03.2020 04:15 stgatilov New Issue
05.03.2020 04:15 stgatilov Status new => assigned
05.03.2020 04:15 stgatilov Assigned To => cabalistic
21.03.2020 17:43 stgatilov Target Version => TDM 2.09
14.12.2020 22:25 nbohr1more Note Added: 0013136
14.12.2020 22:54 nbohr1more Relationship added parent of 0005441
14.12.2020 23:08 nbohr1more Relationship added related to 0004408
15.12.2020 02:41 stgatilov Note Added: 0013137
23.12.2020 13:11 cabalistic Note Added: 0013179
23.12.2020 18:56 nbohr1more Target Version TDM 2.09 => TDM 2.10
23.12.2020 18:57 nbohr1more Note Added: 0013182
04.10.2021 18:19 nbohr1more Note Added: 0014396
04.10.2021 18:19 nbohr1more Target Version TDM 2.10 => TDM 2.11
15.11.2022 00:24 nbohr1more Note Added: 0015421
15.11.2022 00:24 nbohr1more Target Version TDM 2.11 => TDM 2.12
05.12.2023 01:00 nbohr1more Target Version TDM 2.12 => TDM 2.13