2
0
Fork 0
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:
Samuel Neves 2019-03-12 21:52:42 +00:00 committed by GitHub
commit e4ca309b04
Signed by: GitHub
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
}