summaryrefslogtreecommitdiff
path: root/drivers/alsamidi/midi_driver_alsamidi.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-01-31 15:24:56 +0100
committerGitHub <noreply@github.com>2021-01-31 15:24:56 +0100
commit5525cd85c60455b0bb9716bbef0ad2ad8111d752 (patch)
tree52ff0e2d3e01dd2655feff1cf88f07e10d84aad1 /drivers/alsamidi/midi_driver_alsamidi.cpp
parent02eb11450b4151b02db861b5029783e52e16c603 (diff)
parent99fe462452be44efa618e83ad9bbecd722ae6ecd (diff)
Merge pull request #45315 from RandomShaper/modernize_thread
Modernize Thread
Diffstat (limited to 'drivers/alsamidi/midi_driver_alsamidi.cpp')
-rw-r--r--drivers/alsamidi/midi_driver_alsamidi.cpp13
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/alsamidi/midi_driver_alsamidi.cpp b/drivers/alsamidi/midi_driver_alsamidi.cpp
index 2e1034fc66..245ea07730 100644
--- a/drivers/alsamidi/midi_driver_alsamidi.cpp
+++ b/drivers/alsamidi/midi_driver_alsamidi.cpp
@@ -150,19 +150,14 @@ Error MIDIDriverALSAMidi::open() {
snd_device_name_free_hint(hints);
exit_thread = false;
- thread = Thread::create(MIDIDriverALSAMidi::thread_func, this);
+ thread.start(MIDIDriverALSAMidi::thread_func, this);
return OK;
}
void MIDIDriverALSAMidi::close() {
- if (thread) {
- exit_thread = true;
- Thread::wait_to_finish(thread);
-
- memdelete(thread);
- thread = nullptr;
- }
+ exit_thread = true;
+ thread.wait_to_finish();
for (int i = 0; i < connected_inputs.size(); i++) {
snd_rawmidi_t *midi_in = connected_inputs[i];
@@ -198,8 +193,6 @@ PackedStringArray MIDIDriverALSAMidi::get_connected_inputs() {
}
MIDIDriverALSAMidi::MIDIDriverALSAMidi() {
- thread = nullptr;
-
exit_thread = false;
}