View Issue Details

IDProjectCategoryView StatusLast Update
0005169The Dark ModCodingpublic21.03.2020 17:43
Reporterstgatilov Assigned Tocabalistic  
Status assignedResolutionopen 
Product VersionTDM 2.08 
Target VersionTDM 2.09 
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.


There are no notes attached to this issue.

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