1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-16 12:45:18 +03:00
aports/testing/rtmidi/fix-pthread.patch
psykose c1e33c185f testing/rtmidi: new aport
https://github.com/thestk/rtmidi
C++ classes that provide a common API for realtime MIDI input/output
2022-01-25 23:00:29 +00:00

37 lines
1.3 KiB
Diff

Patch-Source: https://github.com/thestk/rtmidi/pull/278
From cfe34c02112c256235b62b45895fc2c401fd874d Mon Sep 17 00:00:00 2001
From: Niclas Rosenvik <youremailsarecrap@gmail.com>
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 <jack/midiport.h>
#include <jack/ringbuffer.h>
#include <pthread.h>
+#include <sched.h>
#ifdef HAVE_SEMAPHORE
#include <semaphore.h>
#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 ) );