1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Implement custom thread numbering for POSIX

For every UNIX-derived (Android, Linux, macOS, iOS) flavor, a global counter is atomically incremented on thread start. That id is kept as thread-local storage.

Therefore, thread ids are sequential numbers, trivially comparable. This improves the previous state of things, in which `pthread_t` were casted to `Thread::ID` and unportabily compared. Also big, ugly thread ids appeared.
This commit is contained in:
Pedro J. Estébanez
2017-08-23 19:18:38 +02:00
parent a560a62118
commit d806ad4a3d
4 changed files with 32 additions and 4 deletions

View File

@@ -41,6 +41,9 @@
class ThreadAndroid : public Thread {
static pthread_key_t thread_id_key;
static ID next_thread_id;
pthread_t pthread;
pthread_attr_t pthread_attr;
ThreadCreateCallback callback;