feat: implement lock-free command queue and atomic state for thread safety
Co-authored-by: aider (deepseek/deepseek-coder) <aider@aider.chat>
This commit is contained in:
13
test_tui.c
13
test_tui.c
@@ -3,6 +3,7 @@
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include "engine.h"
|
||||
#include <stdatomic.h>
|
||||
#include "tui.h"
|
||||
|
||||
// Test helper
|
||||
@@ -16,6 +17,18 @@ static Engine *create_test_engine(void) {
|
||||
engine->quantize_threshold = 0;
|
||||
engine->queued_triggers = NULL;
|
||||
|
||||
// Initialize command queue
|
||||
command_queue_init(&engine->command_queue);
|
||||
|
||||
// Initialize atomic state mirrors
|
||||
atomic_store(&engine->transport_rolling, 0);
|
||||
atomic_store(&engine->transport_clock_count, 0);
|
||||
atomic_store(&engine->transport_beat_position, 0);
|
||||
atomic_store(&engine->transport_bar_position, 0);
|
||||
atomic_store(&engine->transport_sample_position, 0);
|
||||
atomic_store(&engine->quantize_mode_atomic, (int)QUANTIZE_OFF);
|
||||
atomic_store(&engine->quantize_threshold_atomic, 0);
|
||||
|
||||
// Initialize transport
|
||||
engine->transport.rolling = false;
|
||||
engine->transport.clock_count = 0;
|
||||
|
||||
Reference in New Issue
Block a user