-
Notifications
You must be signed in to change notification settings - Fork 77
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
192108b
commit 1221860
Showing
1 changed file
with
34 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
//PARAM: --set ana.activated[+] threadJoins | ||
#include <pthread.h> | ||
|
||
int g = 10; | ||
int h = 10; | ||
pthread_mutex_t A = PTHREAD_MUTEX_INITIALIZER; | ||
|
||
void *t_fun(void *arg) { | ||
g++; // RACE! | ||
return NULL; | ||
} | ||
|
||
void *t_benign(void *arg) { | ||
h++; // NORACE | ||
pthread_t id2; | ||
pthread_create(&id2, NULL, t_fun, NULL); | ||
foo(&id2); | ||
pthread_join(id2, NULL); | ||
return NULL; | ||
} | ||
|
||
int main(void) { | ||
int t; | ||
|
||
pthread_t id2; | ||
pthread_create(&id2, NULL, t_benign, NULL); | ||
pthread_join(id2, NULL); | ||
// t_benign and t_fun should be in here | ||
|
||
g++; // RACE! | ||
h++; // NORACE | ||
|
||
return 0; | ||
} |