mirror of
https://git.sr.ht/~sircmpwn/mkproof
synced 2024-05-28 13:56:09 +02:00
Merge pull request #268 from mbroz/master
Wait for already running threads if a thread creation failed.
This commit is contained in:
commit
e4ca309b04
|
@ -310,7 +310,7 @@ static int fill_memory_blocks_mt(argon2_instance_t *instance) {
|
|||
|
||||
for (r = 0; r < instance->passes; ++r) {
|
||||
for (s = 0; s < ARGON2_SYNC_POINTS; ++s) {
|
||||
uint32_t l;
|
||||
uint32_t l, ll;
|
||||
|
||||
/* 2. Calling threads */
|
||||
for (l = 0; l < instance->lanes; ++l) {
|
||||
|
@ -335,6 +335,9 @@ static int fill_memory_blocks_mt(argon2_instance_t *instance) {
|
|||
sizeof(argon2_position_t));
|
||||
if (argon2_thread_create(&thread[l], &fill_segment_thr,
|
||||
(void *)&thr_data[l])) {
|
||||
/* Wait for already running threads */
|
||||
for (ll = 0; ll < l; ++ll)
|
||||
argon2_thread_join(thread[ll]);
|
||||
rc = ARGON2_THREAD_FAIL;
|
||||
goto fail;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue