rocr: Fix Potential Deadlock

Because eventDescrp->mutex is a non-recursive lock attempting to
acquire the lock with pthread_mutex_lock can cause the system to hang
indefinitely if the lock was already previously aquired with the
preceeding call to pthread_mutex_trylock.

Signed-off-by: Sunday Clement <Sunday.Clement@amd.com>
Cette révision appartient à :
Sunday Clement a créé et Yat Sin, David a révisé 2025-06-04 10:18:09 -04:00
1 Parent f6c8cbd293
révision a97b7df4b9
1 fichier modifié
+4 -1
+4 -1
Voir le fichier
@@ -577,7 +577,10 @@ int WaitForOsEvent(EventHandle event, unsigned int milli_seconds) {
}
int ret_code = 0;
pthread_mutex_lock(&eventDescrp->mutex);
if(milli_seconds != 0) {
pthread_mutex_lock(&eventDescrp->mutex);
}
if (!eventDescrp->state) {
if (milli_seconds == 0) {
ret_code = 1;