47f2db0cc20b0cf48bb17284cd1fab5891673676
3 #include <pthread_extra.h>
9 void *thread_test(void *arg
) {
10 //Whole process dies if you kill thread immediately before it is pausable
11 //pthread_pause_enable();
14 printf("Running%s!\n", (char *)arg
);
21 pthread_pause_enable(); //Will get inherited by all threads from now on
22 //That way you can be sure it is pausable immediately
23 pthread_create(&a
, NULL
, thread_test
, " A");
24 pthread_create(&b
, NULL
, thread_test
, " B");
29 printf("SWITCH A:\n");
32 printf("SWITCH B:\n");
37 printf("SWITCH A+B:\n");
43 pthread_join(a
, NULL
);
44 pthread_join(b
, NULL
);
This page took 0.296759 seconds and 3 git commands to generate.