ed60fcc6d187ae32501f00378033f512921ba8c8
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_extra_create(&a
, NULL
, thread_test
, " A");
24 pthread_extra_create(&b
, NULL
, thread_test
, " B");
29 for(int32_t i = 1;i>0;i++) {
45 printf("SWITCH A:\n");
48 printf("SWITCH B:\n");
53 printf("SWITCH A+B:\n");
58 printf("SWITCH MAIN ONLY:\n");
61 printf("SWITCH MAIN A+B:\n");
62 pthread_unpause_all();
66 pthread_join(a
, NULL
);
67 pthread_join(b
, NULL
);
This page took 0.286388 seconds and 3 git commands to generate.