int pthread_pause_reschedule(pthread_t thread) {
//Send signal to initiate pause handler
- while(pthread_kill(thread, PTHREAD_XSIG_STOP) == EAGAIN) usleep(1000);
+ //while(pthread_kill(thread, PTHREAD_XSIG_STOP) == EAGAIN) usleep(1000);
+ while(pthread_sigqueue(thread, PTHREAD_XSIG_STOP, (const union sigval){.sival_ptr=NULL}) == EAGAIN) usleep(1000);
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;