Skip to content

Commit 670e7cf

Browse files
committed
Add test for Klever's multiple threads
1 parent 717b6a8 commit 670e7cf

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//PARAM: --set ana.activated[+] threadJoins --set lib.activated[+] klever
2+
#include <pthread.h>
3+
#include <goblint.h>
4+
5+
int g = 0;
6+
7+
void *t_fun(void *arg) {
8+
g++; // RACE!
9+
return NULL;
10+
}
11+
12+
int main() {
13+
pthread_t id;
14+
pthread_create_N(&id, NULL, t_fun, NULL); // spawns multiple threads
15+
pthread_join(id, NULL);
16+
17+
g++; // RACE!
18+
19+
pthread_join_N(id, NULL); // TODO: should this join one (do nothing) or all (like assume join)?
20+
21+
g++; // RACE!
22+
23+
return 0;
24+
}

0 commit comments

Comments
 (0)