Patch-Source: https://github.com/thestk/rtmidi/pull/278 From cfe34c02112c256235b62b45895fc2c401fd874d Mon Sep 17 00:00:00 2001 From: Niclas Rosenvik Date: Sun, 19 Dec 2021 13:56:27 +0100 Subject: [PATCH] Use posix sched_yield instead of pthread_yield Use posix sched_yield instead of pthread_yield. pthread_yield is linux specific sched_yield is a standard posix function. pthread_yield on linux is implemented using sched_yield. This makes the jack plugin work on other platforms than linux. --- RtMidi.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RtMidi.cpp b/RtMidi.cpp index 6a1c89e..88b55e1 100644 --- a/RtMidi.cpp +++ b/RtMidi.cpp @@ -3092,6 +3092,7 @@ void MidiOutWinMM :: sendMessage( const unsigned char *message, size_t size ) #include #include #include +#include #ifdef HAVE_SEMAPHORE #include #endif @@ -3608,7 +3609,7 @@ void MidiOutJack :: sendMessage( const unsigned char *message, size_t size ) return; while ( jack_ringbuffer_write_space(data->buff) < sizeof(nBytes) + size ) - pthread_yield(); + sched_yield(); // Write full message to buffer jack_ringbuffer_write( data->buff, ( char * ) &nBytes, sizeof( nBytes ) );