From 1e768138b80b7b94cef922f1fb9d5c4bfa796052 Mon Sep 17 00:00:00 2001 From: enricotenuti Date: Sat, 28 Sep 2024 15:33:06 +0200 Subject: go back to non atomic active --- src/solvers/h48/thread.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/solvers/h48/thread.h b/src/solvers/h48/thread.h index bea34d0..91e092f 100644 --- a/src/solvers/h48/thread.h +++ b/src/solvers/h48/thread.h @@ -7,7 +7,7 @@ typedef struct { int front; int rear; int tasks_count; - atomic_int active; + int active; pthread_mutex_t mutex; pthread_cond_t cond; pthread_cond_t active_cond; @@ -117,11 +117,13 @@ start_thread(void *arg) solve_h48_single(task, queue); - atomic_fetch_sub(&queue->active, 1); + pthread_mutex_lock(&queue->mutex); + queue->active--; if(queue->tasks_count == 0 && queue->active == 0) pthread_cond_signal(&queue->active_cond); } + pthread_mutex_unlock(&queue->mutex); } return NULL; } -- cgit v1.3