commit 1e768138b80b7b94cef922f1fb9d5c4bfa796052
parent 47fe842ee3375ad63cc96550e345d18f3af0885b
Author: enricotenuti <tenutz_27@outlook.it>
Date: Sat, 28 Sep 2024 15:33:06 +0200
go back to non atomic active
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git 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;
}