Closed
Conversation
The projectm_eval_memory_host_lock/unlock_mutex() callbacks were no-ops, providing no protection when multiple preset expressions access shared memory blocks from different threads. Add a real std::mutex so the eval library's built-in synchronization actually works. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Member
|
There's no synchronization needed as no code calls the expressions from separate threads, ever. All calls are serialized, plus each preset has its own megabufs/gmegabuf, so they're not even interfering with each other (I contrast to Milkdrop where all presets share the same megabufs). Adding a mutex will only reduce performance due to locking overhead when accessing megabufs, but with no real issue fixed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
projectm_eval_memory_host_lock/unlock_mutex()callbacks inEvalLibMutex.cppwere empty stubs ({}), providing no synchronization when multiple preset expressions access shared memory blocks (megabuf/gmegabuf) concurrently — e.g., during a soft-cut transition where both the active and transitioning presets evaluate simultaneously.The projectm-eval library already calls these callbacks around shared memory access in
MemoryBuffer.cand documents them as host-provided. This commit implements them with astd::mutex.Changes
src/libprojectM/MilkdropPreset/EvalLibMutex.cpp(+13, -2)Test plan