1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-10-25 09:27:01 +00:00

Corrects some minor outstanding data races.

This commit is contained in:
Thomas Harte
2018-02-18 16:37:07 -05:00
parent c8a4432c63
commit a005dabbe3
4 changed files with 8 additions and 7 deletions

View File

@@ -48,11 +48,13 @@ void MultiSpeaker::set_delegate(Outputs::Speaker::Speaker::Delegate *delegate) {
}
void MultiSpeaker::speaker_did_complete_samples(Speaker *speaker, const std::vector<int16_t> &buffer) {
std::lock_guard<std::mutex> lock_guard(front_speaker_mutex_);
if(delegate_ && speaker == front_speaker_) {
delegate_->speaker_did_complete_samples(this, buffer);
}
}
void MultiSpeaker::set_new_front_machine(::Machine::DynamicMachine *machine) {
std::lock_guard<std::mutex> lock_guard(front_speaker_mutex_);
front_speaker_ = machine->crt_machine()->get_speaker();
}