fix: process commands only after all worker threads finish in stress test

Co-authored-by: aider (deepseek/deepseek-coder) <aider@aider.chat>
This commit is contained in:
Loic Coenen
2026-05-01 23:41:48 +00:00
parent 31653d8b4a
commit 8dff1ade1a

View File

@@ -483,17 +483,12 @@ static void stress_concurrent(void) {
pthread_create(&threads[t], NULL, thread_worker, &args[t]);
}
// Process commands in main thread while workers submit
for (int i = 0; i < ops_per_thread * 2; i++) {
engine_process_commands(engine);
random_sleep_us();
}
// Wait for all worker threads to finish before processing commands
for (int t = 0; t < NUM_THREADS; t++) {
pthread_join(threads[t], NULL);
}
// Process remaining commands
// Process all submitted commands
engine_process_commands(engine);
int total_success = 0;