|
From: <sv...@va...> - 2008-06-30 11:13:28
|
Author: bart Date: 2008-06-30 12:13:35 +0100 (Mon, 30 Jun 2008) New Revision: 8319 Log: Fixed race condition which could make the test program hang (signal could be sent before pthread_cond_wait() started). Modified: trunk/exp-drd/tests/pth_inconsistent_cond_wait.c Modified: trunk/exp-drd/tests/pth_inconsistent_cond_wait.c =================================================================== --- trunk/exp-drd/tests/pth_inconsistent_cond_wait.c 2008-06-30 10:56:18 UTC (rev 8318) +++ trunk/exp-drd/tests/pth_inconsistent_cond_wait.c 2008-06-30 11:13:35 UTC (rev 8319) @@ -44,6 +44,10 @@ pthread_create(&tid1, 0, &thread1, 0); pthread_create(&tid2, 0, &thread2, 0); sem_wait(&s_sem); + pthread_mutex_lock(&s_mutex1); + pthread_mutex_lock(&s_mutex2); + pthread_mutex_unlock(&s_mutex2); + pthread_mutex_unlock(&s_mutex1); pthread_cond_signal(&s_cond); pthread_cond_signal(&s_cond); pthread_join(tid1, 0); |