Skip to content

Commit

Permalink
Fix race in race_reach test for sv-benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
sim642 committed Sep 29, 2023
1 parent cb500ed commit ee6dc36
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/regression/28-race_reach/61-invariant_racing.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;

void *t_fun(void *arg) {
pthread_mutex_lock(&mutex);
if (x == 0) {
pthread_mutex_lock(&__global_lock);
if (x == 0) { // NORACE
pthread_mutex_unlock(&__global_lock);
pthread_mutex_unlock(&mutex);
} else {
pthread_mutex_unlock(&__global_lock);
pthread_mutex_unlock(&mutex);
access(x);
}
Expand Down

0 comments on commit ee6dc36

Please sign in to comment.