Skip to content

Commit 49cd2ce

Browse files
committed
Revert fuel change to incremental 13-restart-write/01-mutex-simple
Adds copy of test with fuel instead.
1 parent 99f8b20 commit 49cd2ce

File tree

4 files changed

+59
-2
lines changed

4 files changed

+59
-2
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#include <pthread.h>
2+
#include <stdio.h>
3+
4+
int myglobal;
5+
pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
6+
pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER;
7+
8+
void *t_fun(void *arg) {
9+
pthread_mutex_lock(&mutex1);
10+
myglobal=myglobal+1; // RACE!
11+
pthread_mutex_unlock(&mutex1);
12+
return NULL;
13+
}
14+
15+
int main(void) {
16+
pthread_t id;
17+
pthread_create(&id, NULL, t_fun, NULL);
18+
pthread_mutex_lock(&mutex2);
19+
myglobal=myglobal+1; // RACE!
20+
pthread_mutex_unlock(&mutex2);
21+
pthread_join (id, NULL);
22+
return 0;
23+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"incremental": {
3+
"restart": {
4+
"sided": {
5+
"enabled": true,
6+
"fuel": 1
7+
},
8+
"write-only": false
9+
}
10+
}
11+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--- tests/incremental/11-restart/17-mutex-simple-fuel.c
2+
+++ tests/incremental/11-restart/17-mutex-simple-fuel.c
3+
@@ -7,7 +7,7 @@ pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER;
4+
5+
void *t_fun(void *arg) {
6+
pthread_mutex_lock(&mutex1);
7+
- myglobal=myglobal+1; // RACE!
8+
+ myglobal=myglobal+1; // NORACE
9+
pthread_mutex_unlock(&mutex1);
10+
return NULL;
11+
}
12+
@@ -15,9 +15,9 @@ void *t_fun(void *arg) {
13+
int main(void) {
14+
pthread_t id;
15+
pthread_create(&id, NULL, t_fun, NULL);
16+
- pthread_mutex_lock(&mutex2);
17+
- myglobal=myglobal+1; // RACE!
18+
- pthread_mutex_unlock(&mutex2);
19+
+ pthread_mutex_lock(&mutex1);
20+
+ myglobal=myglobal+1; // NORACE
21+
+ pthread_mutex_unlock(&mutex1);
22+
pthread_join (id, NULL);
23+
return 0;
24+
}

tests/incremental/13-restart-write/01-mutex-simple.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
"incremental": {
33
"restart": {
44
"sided": {
5-
"enabled": true,
6-
"fuel": 1
5+
"enabled": false
76
}
87
}
98
}

0 commit comments

Comments
 (0)