-
Notifications
You must be signed in to change notification settings - Fork 143
Open
Description
In thread.h thread_mutex_lock() doesn't behave the same on Windows as on Linux/macOS. On Windows it is recursive, meaning you can double-lock a mutex on the same thread, but on Linux as it is it will deadlock. My personal solution is making the pthread one also recursive by replacing pthread_mutex_init( (pthread_mutex_t*) mutex, NULL ); with:
pthread_mutexattr_t ma;
pthread_mutexattr_init(&ma);
pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init((pthread_mutex_t *) mutex, &ma);
pthread_mutexattr_destroy(&ma);
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels