refactor: improve stress test stability and memory ordering in engine

This commit is contained in:
Loic Coenen
2026-05-23 15:13:04 +00:00
committed by Loic Coenen (aider)
parent d6bd31fed5
commit 0537263a7a
4 changed files with 28 additions and 55 deletions

View File

@@ -72,8 +72,8 @@ void channel_add(jack_client_t *client, int idx) {
void channel_remove(jack_client_t *client, int idx) {
(void)client;
atomic_store(&channels[idx].active, 0);
atomic_fetch_sub(&channel_count, 1);
atomic_store_explicit(&channels[idx].active, 0, memory_order_release);
atomic_fetch_sub_explicit(&channel_count, 1, memory_order_release);
}
void channel_add_scene(jack_client_t *client, int idx) {

View File

@@ -116,9 +116,6 @@ static void exec_command(command_t cmd, jack_client_t *client) {
// Restore the requested scene (channel_add or add_scene may have reset current_scene)
atomic_store(&channels[ch].current_scene, requested_scene);
// Give JACK time to register ports if we created something
struct timespec req = {.tv_sec = 0, .tv_nsec = 200000000};
nanosleep(&req, NULL);
int sc_idx = atomic_load(&channels[ch].current_scene);
scene_t *sc_ptr = &channels[ch].scenes[sc_idx];

View File

@@ -52,7 +52,7 @@ int main(int argc, char *argv[]) {
while (1) {
looper_process_commands(client);
{
struct timespec ts = {.tv_sec = 0, .tv_nsec = 50000000};
struct timespec ts = {.tv_sec = 0, .tv_nsec = 10000000};
nanosleep(&ts, NULL);
}
}