mirror of
https://github.com/bitwiseworks/gcc-os2.git
synced 2026-02-13 21:54:40 +00:00
Make C++ thread interface thread-safe #24
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @dmik on GitHub (Mar 31, 2020).
There is C++ thread support added by @komh in
203e99b908. However,__gthread_createand other functions dealing with shared thread data (like the thread list) are not thread-safe. This means that if two threads call__gthread_create(i.e. instantiate anstd::thread object) at the same time, data corruption is likely to occur.We should make this interface thread-safe. One way to do so is to use the Posix code, i.e. switch to using our PTHREAD library (whose
pthread_createand other APIs are already thread-safe). This has also a benefit of bringing pthread key destructor support to all C++ threads (see https://github.com/bitwiseworks/pthread-os2/issues/1).See also https://github.com/bitwiseworks/pthread-os2/issues/2#issuecomment-603811814.