h48

A prototype for an optimal Rubik's cube solver, work in progress.
git clone https://git.tronto.net/h48
Download | Log | Files | Refs | README | LICENSE

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:
Msrc/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 @@ -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; }