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_cli.c
13
test_cli.c
@@ -2,6 +2,7 @@
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include "engine.h"
|
||||
#include <stdatomic.h>
|
||||
#include "cli.h"
|
||||
|
||||
// Minimal test: just ensure parsing doesn't crash
|
||||
@@ -16,6 +17,18 @@ static void test_cli_parse(void) {
|
||||
engine.quantize_mode = QUANTIZE_OFF;
|
||||
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);
|
||||
engine.transport.rolling = false;
|
||||
engine.transport.clock_count = 0;
|
||||
engine.transport.beat_position = 0;
|
||||
|
||||
Reference in New Issue
Block a user