extra yield
authorTomas Mudrunka <tomas@mudrunka.cz>
Tue, 29 Jun 2021 14:39:06 +0000 (16:39 +0200)
committerTomas Mudrunka <tomas@mudrunka.cz>
Tue, 29 Jun 2021 14:39:06 +0000 (16:39 +0200)
c/pthread_extra/pthread_extra.h
c/pthread_extra/pthread_pause.c

index 15e4d8bd39c88fe49391c4e51ab56342092e0977..58a98e368750d356664e09395ae89c2b2dc64d19 100644 (file)
@@ -47,6 +47,7 @@ void pthread_pause_enable();
 int pthread_pause(pthread_t thread);
 int pthread_unpause(pthread_t thread);
 int pthread_pause_reschedule(pthread_t thread);
+int pthread_extra_yield();
 
 // Message queues
 
index c0d43507d12702e4b6174d99d299e8cbbb3700df..d168121f20e6fb986440380865beb5bbe2cb2867 100644 (file)
@@ -63,6 +63,12 @@ int pthread_pause_reschedule(pthread_t thread) {
        return 0;
 }
 
+int pthread_extra_yield() {
+       //Yield to both schedulers
+       pthread_pause_reschedule(pthread_self());
+       return pthread_yield();
+}
+
 int pthread_pause(pthread_t thread) {
        //Set thread as paused and notify it via signal (wait when queue full)
        pthread_user_data_internal(thread)->running = 0;
This page took 0.169693 seconds and 4 git commands to generate.