Open ryancaicse opened 2 years ago
Here is another one similar to the above. https://github.com/n64dev/cen64/blob/1b31ca9b3c3bb783391ab9773bd26c50db2056a8/device/device.c#L230-L255
Could anyone take a look? thanks
This is expected... see the manpage for pthread_cond_wait
:
These functions atomically release mutex and cause the calling thread to block on the condition variable cond; atomically here means "atomically with respect to access by another thread to the mutex and then the condition variable".
Hi, it seems that lock
device->sync_mutex
is missed to be released after 248. In the while loop, the lock could be acquired twice and a deadlock occurs. https://github.com/n64dev/cen64/blob/1b31ca9b3c3bb783391ab9773bd26c50db2056a8/device/device.c#L230-L256