From 716ba3328f749e835c72d0549fc8d55cc099487b Mon Sep 17 00:00:00 2001 From: "Alex Xu (Hello71)" Date: Thu, 16 Dec 2021 10:35:25 -0500 Subject: [PATCH] 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. --- src/core.c | 1 - src/thread.c | 8 -------- src/thread.h | 5 ----- 3 files changed, 14 deletions(-) diff --git a/src/core.c b/src/core.c index e697882..77c52d4 100644 --- a/src/core.c +++ b/src/core.c @@ -284,7 +284,6 @@ static void *fill_segment_thr(void *thread_data) { argon2_thread_data *my_data = thread_data; fill_segment(my_data->instance_ptr, my_data->pos); - argon2_thread_exit(); return 0; } diff --git a/src/thread.c b/src/thread.c index 3ae2fb2..9fd15ed 100644 --- a/src/thread.c +++ b/src/thread.c @@ -46,12 +46,4 @@ int argon2_thread_join(argon2_thread_handle_t handle) { #endif } -void argon2_thread_exit(void) { -#if defined(_WIN32) - _endthreadex(0); -#else - pthread_exit(NULL); -#endif -} - #endif /* ARGON2_NO_THREADS */ diff --git a/src/thread.h b/src/thread.h index d4ca10c..478e260 100644 --- a/src/thread.h +++ b/src/thread.h @@ -58,10 +58,5 @@ int argon2_thread_create(argon2_thread_handle_t *handle, */ int argon2_thread_join(argon2_thread_handle_t handle); -/* Terminate the current thread. Must be run inside a thread created by - * argon2_thread_create. -*/ -void argon2_thread_exit(void); - #endif /* ARGON2_NO_THREADS */ #endif