Skip to content

Commit ddc71fe

Browse files
committed
Add better documentation of pthread_cond_waits mutex usage
1 parent e676eae commit ddc71fe

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

regression/cbmc-sequentialization/pthread_cond/checked_signal.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ void initialise_condition(void)
2424
}
2525

2626
// Wait for signal. Note that pthreads requires us to lock and unlock the mutex
27-
// around the call to `pthread_cond_wait`.
27+
// around the call to `pthread_cond_wait`. Note also that if called
28+
// pthread_cond_wait function waits then it will leave the mutex unlocked whilst
29+
// it is waiting.
2830
void wait(void)
2931
{
3032
const int lock_error = pthread_mutex_lock(&signal_mutex);

regression/cbmc-sequentialization/pthread_cond/spurious_wakeup.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ void initialise_condition(void)
2323
}
2424

2525
// Wait for signal. Note that pthreads requires us to lock and unlock the mutex
26-
// around the call to `pthread_cond_wait`.
26+
// around the call to `pthread_cond_wait`. Note also that if called
27+
// pthread_cond_wait function waits then it will leave the mutex unlocked whilst
28+
// it is waiting.
2729
void wait(void)
2830
{
2931
const int lock_error = pthread_mutex_lock(&signal_mutex);

0 commit comments

Comments
 (0)