Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix race conditions (2) #514

Merged
merged 3 commits into from
Oct 21, 2020
Merged

Fix race conditions (2) #514

merged 3 commits into from
Oct 21, 2020

Conversation

jpcima
Copy link
Collaborator

@jpcima jpcima commented Oct 21, 2020

expected to fix #511

It was observed that QueuedFileData has a FileId member, and it's copied, therefore not RT-safe.

This implements the file queue in a different strategy, and removed problematic code at the same time.

  • replace FileId Region::sampleId with a shared pointer.
    That permits to pass it in the message queue, without worrying about a corruption in case the region gets removed while the FileId is still in the queue.

  • the queued file data receives a id member of type weak_ptr, meaning it auto-nulls itself if the Region gets deleted.
    In this model, the FilePool must null-check the id at relevant places to check that the request is still valid.
    Since it auto-nulls on erasing regions, we don't need emptyFileLoadingQueues, loading jobs will clean themselves.

@jpcima jpcima merged commit 7962e9c into sfztools:develop Oct 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Concurrency issue blocks the sfz tests
1 participant