-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
24d61c0
commit 8fe2e16
Showing
3 changed files
with
106 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// NOMAC PARAM: --set ana.activated[+] 'pthreadBarriers' | ||
#include<pthread.h> | ||
#include<stdio.h> | ||
#include<unistd.h> | ||
|
||
int g; | ||
|
||
pthread_barrier_t barrier; | ||
pthread_mutex_t mutex; | ||
|
||
void* f1(void* ptr) { | ||
pthread_mutex_lock(&mutex); | ||
pthread_barrier_wait(&barrier); | ||
pthread_mutex_unlock(&mutex); | ||
return NULL; | ||
} | ||
|
||
int main(int argc, char const *argv[]) | ||
{ | ||
int top; | ||
int i = 0; | ||
|
||
pthread_barrier_init(&barrier, NULL, 2); | ||
|
||
pthread_t t1; | ||
pthread_create(&t1,NULL,f1,NULL); | ||
|
||
if(top) { | ||
pthread_mutex_lock(&mutex); | ||
pthread_barrier_wait(&barrier); | ||
// Deadlocks | ||
pthread_mutex_unlock(&mutex); | ||
i = 1; | ||
} | ||
|
||
__goblint_check(i == 0); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// NOMAC PARAM: --set ana.activated[+] 'pthreadBarriers' | ||
#include<pthread.h> | ||
#include<stdio.h> | ||
#include<unistd.h> | ||
|
||
int g; | ||
|
||
pthread_barrier_t barrier; | ||
pthread_mutex_t mutex; | ||
|
||
void* f1(void* ptr) { | ||
pthread_mutex_lock(&mutex); | ||
pthread_barrier_wait(&barrier); | ||
pthread_mutex_unlock(&mutex); | ||
return NULL; | ||
} | ||
|
||
void* f2(void* ptr) { | ||
pthread_mutex_lock(&mutex); | ||
pthread_barrier_wait(&barrier); | ||
pthread_mutex_unlock(&mutex); | ||
return NULL; | ||
} | ||
|
||
int main(int argc, char const *argv[]) | ||
{ | ||
int top; | ||
int i = 0; | ||
|
||
pthread_barrier_init(&barrier, NULL, 2); | ||
|
||
pthread_t t1; | ||
pthread_create(&t1,NULL,f1,NULL); | ||
|
||
pthread_t t2; | ||
pthread_create(&t2,NULL,f2,NULL); | ||
|
||
|
||
if(top) { | ||
pthread_barrier_wait(&barrier); | ||
i = 1; | ||
} | ||
|
||
__goblint_check(i == 0); //UNKNOWN! | ||
|
||
return 0; | ||
} |