X-Git-Url: http://git.harvie.cz/?a=blobdiff_plain;f=c%2Fpthread_extra%2Ftest_pause.c;h=c12de5a36bc614ff960c862601706593dc7e1b12;hb=0b8d006aa72c56eff1368c6c69b09547c455a5ed;hp=b99c388c735cc3ac0579fcace9f6cfa815a4df7f;hpb=de59b17efb67056de9a5182dbbeed27aed68117c;p=mirrors%2FPrograms.git diff --git a/c/pthread_extra/test_pause.c b/c/pthread_extra/test_pause.c index b99c388..c12de5a 100644 --- a/c/pthread_extra/test_pause.c +++ b/c/pthread_extra/test_pause.c @@ -1,3 +1,5 @@ +#define PTHREAD_FREEWHEEL + #include #include #include @@ -6,6 +8,8 @@ #include #include +//#define printf(...) (0) + pthread_t main_thread; void *thread_test(void *arg) { @@ -50,20 +54,35 @@ int main() { while(1) { pthread_pause(b); pthread_unpause(a); + pthread_pause_disable(); + pthread_pause_disable(); + pthread_pause_disable(); printf("SWITCH A:\n"); + pthread_pause_enable(); + pthread_pause_enable(); + pthread_pause_enable(); pthread_sleep(2); + pthread_pause_all(); printf("SWITCH B:\n"); + pthread_unpause_all(); pthread_pause(a); pthread_unpause(b); pthread_sleep(2); + //pthread_pause_disable(); + pthread_pause_all(); printf("SWITCH A+B:\n"); + pthread_unpause_all(); + //pthread_pause_enable(); pthread_unpause(a); pthread_unpause(b); pthread_sleep(1); + //pthread_pause_disable(); + pthread_pause_all(); printf("SWITCH MAIN ONLY:\n"); + //pthread_pause_enable(); pthread_pause_all(); //printf("\n"); pthread_sleep(1);