diff options
| author | enricotenuti <tenutz_27@outlook.it> | 2024-09-27 15:47:03 +0200 |
|---|---|---|
| committer | enricotenuti <tenutz_27@outlook.it> | 2024-09-27 15:47:03 +0200 |
| commit | 47fe842ee3375ad63cc96550e345d18f3af0885b (patch) | |
| tree | 7f67ac911546b9caef2ede7018b9a553409e5f12 /src | |
| parent | 3cb66440de97a787a974eed87a5fd876b46cef92 (diff) | |
| download | nissy-core-47fe842ee3375ad63cc96550e345d18f3af0885b.tar.gz nissy-core-47fe842ee3375ad63cc96550e345d18f3af0885b.zip | |
format fix thread.h
Diffstat (limited to 'src')
| -rw-r--r-- | src/nissy.c | 4 | ||||
| -rw-r--r-- | src/solvers/h48/thread.h | 12 |
2 files changed, 4 insertions, 12 deletions
diff --git a/src/nissy.c b/src/nissy.c index 5eeb457..56acf25 100644 --- a/src/nissy.c +++ b/src/nissy.c | |||
| @@ -333,8 +333,8 @@ nissy_solve( | |||
| 333 | ret = -1; | 333 | ret = -1; |
| 334 | } else { | 334 | } else { |
| 335 | ret = THREADS > 1 ? | 335 | ret = THREADS > 1 ? |
| 336 | solve_h48_parent(c, minmoves, maxmoves, maxsolutions, data, solutions) : | 336 | solve_h48_parent(c, minmoves, maxmoves, maxsolutions, data, solutions) : |
| 337 | solve_h48(c, minmoves, maxmoves, maxsolutions, data, solutions); | 337 | solve_h48(c, minmoves, maxmoves, maxsolutions, data, solutions); |
| 338 | } | 338 | } |
| 339 | } else if (!strcmp(solver, "h48stats")) { | 339 | } else if (!strcmp(solver, "h48stats")) { |
| 340 | ret = solve_h48stats(c, maxmoves, data, solutions); | 340 | ret = solve_h48stats(c, maxmoves, data, solutions); |
diff --git a/src/solvers/h48/thread.h b/src/solvers/h48/thread.h index c76c9d6..bea34d0 100644 --- a/src/solvers/h48/thread.h +++ b/src/solvers/h48/thread.h | |||
| @@ -1,13 +1,8 @@ | |||
| 1 | #include <pthread.h> | ||
| 2 | #include <stdatomic.h> | 1 | #include <stdatomic.h> |
| 3 | #include <stdbool.h> | ||
| 4 | #include <stdio.h> | ||
| 5 | #include <stdlib.h> | ||
| 6 | 2 | ||
| 7 | #define MAX_QUEUE_SIZE 244 | 3 | #define MAX_QUEUE_SIZE 244 |
| 8 | #define BFS_DEPTH 2 | 4 | #define BFS_DEPTH 2 |
| 9 | typedef struct | 5 | typedef struct { |
| 10 | { | ||
| 11 | dfsarg_solveh48_t *tasks[MAX_QUEUE_SIZE]; | 6 | dfsarg_solveh48_t *tasks[MAX_QUEUE_SIZE]; |
| 12 | int front; | 7 | int front; |
| 13 | int rear; | 8 | int rear; |
| @@ -95,12 +90,10 @@ copy_queue(task_queue_t *src, task_queue_t *dest, int depth, int64_t *nsols) | |||
| 95 | dest->front = src->front; | 90 | dest->front = src->front; |
| 96 | dest->rear = src->rear; | 91 | dest->rear = src->rear; |
| 97 | dest->tasks_count = src->tasks_count; | 92 | dest->tasks_count = src->tasks_count; |
| 98 | // atomic_init(&dest->active, &src->active); | ||
| 99 | pthread_cond_broadcast(&dest->cond); | 93 | pthread_cond_broadcast(&dest->cond); |
| 100 | pthread_mutex_unlock(&dest->mutex); | 94 | pthread_mutex_unlock(&dest->mutex); |
| 101 | } | 95 | } |
| 102 | 96 | ||
| 103 | |||
| 104 | STATIC void * | 97 | STATIC void * |
| 105 | start_thread(void *arg) | 98 | start_thread(void *arg) |
| 106 | { | 99 | { |
| @@ -253,8 +246,7 @@ solve_h48_parent( | |||
| 253 | tableinfo_t info; | 246 | tableinfo_t info; |
| 254 | pthread_t threads[THREADS]; | 247 | pthread_t threads[THREADS]; |
| 255 | 248 | ||
| 256 | if (!readtableinfo_n(data, 2, &info)) | 249 | if (!readtableinfo_n(data, 2, &info)){ |
| 257 | { | ||
| 258 | LOG("solve_h48: error reading table\n"); | 250 | LOG("solve_h48: error reading table\n"); |
| 259 | return 0; | 251 | return 0; |
| 260 | } | 252 | } |
