aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-10-03 20:06:11 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-10-03 20:06:11 +0200
commit41fd9c1b91304e7cfb52ed0a3964aa22fcc37c2e (patch)
treed90d41c6e650714f94c024d55ae2c95ee8830fa2 /src
parent9de887d8f178cec5693cafb03b8715804669f65e (diff)
downloadnissy-core-41fd9c1b91304e7cfb52ed0a3964aa22fcc37c2e.tar.gz
nissy-core-41fd9c1b91304e7cfb52ed0a3964aa22fcc37c2e.zip
Removed useless lock
Diffstat (limited to 'src')
-rw-r--r--src/solvers/h48/gendata_h48.h10
1 files changed, 1 insertions, 9 deletions
diff --git a/src/solvers/h48/gendata_h48.h b/src/solvers/h48/gendata_h48.h
index c977109..ce02946 100644
--- a/src/solvers/h48/gendata_h48.h
+++ b/src/solvers/h48/gendata_h48.h
@@ -60,8 +60,6 @@ typedef struct {
60 uint64_t start; 60 uint64_t start;
61 uint64_t end; 61 uint64_t end;
62 uint64_t count; 62 uint64_t count;
63 uint64_t *distribution;
64 pthread_mutex_t *distribution_mutex;
65 pthread_mutex_t *table_mutex[CHUNKS]; 63 pthread_mutex_t *table_mutex[CHUNKS];
66} h48h0k4_bfs_arg_t; 64} h48h0k4_bfs_arg_t;
67 65
@@ -214,7 +212,7 @@ gendata_h48h0k4(gendata_h48_arg_t *arg)
214 uint64_t t, tt, isize, cc; 212 uint64_t t, tt, isize, cc;
215 h48h0k4_bfs_arg_t bfsarg[THREADS]; 213 h48h0k4_bfs_arg_t bfsarg[THREADS];
216 pthread_t thread[THREADS]; 214 pthread_t thread[THREADS];
217 pthread_mutex_t distribution_mutex, table_mutex[CHUNKS]; 215 pthread_mutex_t table_mutex[CHUNKS];
218 216
219 if (arg->buf == NULL) 217 if (arg->buf == NULL)
220 goto gendata_h48h0k4_return_size; 218 goto gendata_h48h0k4_return_size;
@@ -244,7 +242,6 @@ gendata_h48h0k4(gendata_h48_arg_t *arg)
244 242
245 isize = h48max / THREADS; 243 isize = h48max / THREADS;
246 isize = (isize / H48_COEFF(arg->k)) * H48_COEFF(arg->k); 244 isize = (isize / H48_COEFF(arg->k)) * H48_COEFF(arg->k);
247 pthread_mutex_init(&distribution_mutex, NULL);
248 for (t = 0; t < CHUNKS; t++) 245 for (t = 0; t < CHUNKS; t++)
249 pthread_mutex_init(&table_mutex[t], NULL); 246 pthread_mutex_init(&table_mutex[t], NULL);
250 for (t = 0; t < THREADS; t++) { 247 for (t = 0; t < THREADS; t++) {
@@ -255,8 +252,6 @@ gendata_h48h0k4(gendata_h48_arg_t *arg)
255 .crep = arg->crep, 252 .crep = arg->crep,
256 .start = isize * t, 253 .start = isize * t,
257 .end = t == THREADS-1 ? (uint64_t)h48max : isize * (t+1), 254 .end = t == THREADS-1 ? (uint64_t)h48max : isize * (t+1),
258 .distribution = arg->info.distribution,
259 .distribution_mutex = &distribution_mutex,
260 }; 255 };
261 for (tt = 0; tt < CHUNKS; tt++) 256 for (tt = 0; tt < CHUNKS; tt++)
262 bfsarg[t].table_mutex[tt] = &table_mutex[tt]; 257 bfsarg[t].table_mutex[tt] = &table_mutex[tt];
@@ -344,10 +339,7 @@ gendata_h48h0k4_runthread(void *arg)
344 } 339 }
345 } 340 }
346 341
347 pthread_mutex_lock(bfsarg->distribution_mutex);
348 bfsarg->count += d; 342 bfsarg->count += d;
349 bfsarg->distribution[bfsarg->depth] += d;
350 pthread_mutex_unlock(bfsarg->distribution_mutex);
351 343
352 return NULL; 344 return NULL;
353} 345}

Generated with cgit - Back to sebastiano.tronto.net