Skip to content

Commit 46efbc0

Browse files
Hello71mbroz
authored andcommitted
argon2: Don't call _endthreadex/pthread_exit
Returning from the thread creation function is documented to be a valid way of exiting a thread on both Windows and pthread systems. Removing the explicit call avoids the need to install libgcc_s.so in initramfs for glibc systems, and slightly reduces code size. Upstream: P-H-C/phc-winner-argon2#331
1 parent 903dae1 commit 46efbc0

File tree

3 files changed

+0
-14
lines changed

3 files changed

+0
-14
lines changed

lib/crypto_backend/argon2/core.c

-1
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,6 @@ static void *fill_segment_thr(void *thread_data)
279279
{
280280
argon2_thread_data *my_data = thread_data;
281281
fill_segment(my_data->instance_ptr, my_data->pos);
282-
argon2_thread_exit();
283282
return 0;
284283
}
285284

lib/crypto_backend/argon2/thread.c

-8
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,4 @@ int argon2_thread_join(argon2_thread_handle_t handle) {
4646
#endif
4747
}
4848

49-
void argon2_thread_exit(void) {
50-
#if defined(_WIN32)
51-
_endthreadex(0);
52-
#else
53-
pthread_exit(NULL);
54-
#endif
55-
}
56-
5749
#endif /* ARGON2_NO_THREADS */

lib/crypto_backend/argon2/thread.h

-5
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,5 @@ int argon2_thread_create(argon2_thread_handle_t *handle,
5858
*/
5959
int argon2_thread_join(argon2_thread_handle_t handle);
6060

61-
/* Terminate the current thread. Must be run inside a thread created by
62-
* argon2_thread_create.
63-
*/
64-
void argon2_thread_exit(void);
65-
6661
#endif /* ARGON2_NO_THREADS */
6762
#endif

0 commit comments

Comments
 (0)