Browse Source

Set names of RtMidi threads.

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
a6ad500f97
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      src/rtmidi.cpp

+ 6
- 1
src/rtmidi.cpp View File

@@ -74,6 +74,8 @@ struct RtMidiInputDevice : midi::InputDevice {
if (!userData) if (!userData)
return; return;


system::setThreadName("RtMidi input");

RtMidiInputDevice* midiInputDevice = (RtMidiInputDevice*) userData; RtMidiInputDevice* midiInputDevice = (RtMidiInputDevice*) userData;
if (!midiInputDevice) if (!midiInputDevice)
return; return;
@@ -170,6 +172,8 @@ struct RtMidiOutputDevice : midi::OutputDevice {
} }


void runThread() { void runThread() {
system::setThreadName("RtMidi output");

std::unique_lock<decltype(mutex)> lock(mutex); std::unique_lock<decltype(mutex)> lock(mutex);
while (!stopped) { while (!stopped) {
if (messageQueue.empty()) { if (messageQueue.empty()) {
@@ -210,7 +214,8 @@ struct RtMidiOutputDevice : midi::OutputDevice {
stopped = true; stopped = true;
cv.notify_one(); cv.notify_one();
} }
thread.join();
if (thread.joinable())
thread.join();
} }
}; };




Loading…
Cancel
Save