GIT.Harvie.CZ
/
mirrors
/
Programs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Exclusive mode seems to work without deadlocks
[mirrors/Programs.git]
/
c
/
pthread_extra
/
test_pause.c
diff --git
a/c/pthread_extra/test_pause.c
b/c/pthread_extra/test_pause.c
index 439c6d8d22de9da53d1807b2b42222e835cb03b3..b99c388c735cc3ac0579fcace9f6cfa815a4df7f 100644
(file)
--- a/
c/pthread_extra/test_pause.c
+++ b/
c/pthread_extra/test_pause.c
@@
-13,10
+13,10
@@
void *thread_test(void *arg) {
//pthread_pause_enable();
while(1) {
pthread_nsleep(0, 1000*1000*300);
//pthread_pause_enable();
while(1) {
pthread_nsleep(0, 1000*1000*300);
- //pthread_pause_all();
- pthread_pause(main_thread);
+ pthread_pause_all();
printf("Running%s!\n", (char *)arg);
printf("Running%s!\n", (char *)arg);
- //pthread_unpause_all();
+ pthread_unpause_all();
+ pthread_pause(main_thread);
pthread_unpause(main_thread);
}
}
pthread_unpause(main_thread);
}
}
@@
-65,9
+65,11
@@
int main() {
printf("SWITCH MAIN ONLY:\n");
pthread_pause_all();
printf("SWITCH MAIN ONLY:\n");
pthread_pause_all();
+ //printf("\n");
pthread_sleep(1);
printf("SWITCH MAIN A+B:\n");
pthread_unpause_all();
pthread_sleep(1);
printf("SWITCH MAIN A+B:\n");
pthread_unpause_all();
+ //printf("\n");
pthread_sleep(1);
}
pthread_sleep(1);
}
This page took
0.158122 seconds
and
4
git commands to generate.