Skip to content

Commit

Permalink
devices/liquidsfz/liquidsfz.cc: fix for LiquidSFZ race cond by Stefan…
Browse files Browse the repository at this point in the history
… Westerfeld, #44

#44

swesterfeld commented Jun 18, 2024:
>
> tim-janik commented Jun 18, 2024:
> > all input events must always be processed in render
>
> I agree. At least the filename changes, midi events can safely be dropped while a file is being loaded.
>
> Your patch is not good, because it will introduce race conditions of both threads accessing the same data.
> Since we cannot use locks due to RT constraints, I guess the real fix will be to use a lock-free queue to send events to the loader thread.
> I'll look into it and come up with a real fix and submit a PR.
> However, here is a quick fix that just avoids the initial load problem and is still safe as in it doesn't introduce race conditions

Signed-off-by: Tim Janik <[email protected]>
  • Loading branch information
Stefan Westerfeld authored and tim-janik committed Jun 18, 2024
1 parent da20031 commit f26784b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion devices/liquidsfz/liquidsfz.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class LiquidSFZLoader
{
if (state_.load() == STATE_IDLE)
{
if (want_sfz_ == have_sfz_ && want_sample_rate_ == have_sample_rate_)
if (want_sfz_ == have_sfz_ && (want_sample_rate_ == have_sample_rate_ || want_sfz_ == ""))
return true;
}
state_.store (STATE_LOAD);
Expand Down

0 comments on commit f26784b

Please sign in to comment.