Skip to content

Commit

Permalink
use local variable instead of global
Browse files Browse the repository at this point in the history
  • Loading branch information
qmuntal committed Sep 5, 2024
1 parent c72dedf commit 9c3b08b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions thread_setup_unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ static pthread_mutex_t *mutex_buf = NULL;

static pthread_key_t destructor_key;

/* An unused value whose address is passed to pthread_setspecific. It only needs to have a valid size. See https://github.com/golang-fips/openssl/pull/162. */
static char stub;

/* Used by unit tests. */
volatile unsigned int go_openssl_threads_cleaned_up = 0;

Expand All @@ -31,7 +28,10 @@ static void thread_id(GO_CRYPTO_THREADID_PTR tid)
// per-thread error state, so this function is guaranteed to be executed at
// least once on any thread with associated error state. The thread-local
// variable needs to be set to a non-NULL value so that the destructor will
// be called when the thread exits. The actual value does not matter.
// be called when the thread exits.
// The actual value does not matter, but should be a pointer with a valid size.
// See https://github.com/golang-fips/openssl/pull/162
static char stub;
(void) pthread_setspecific(destructor_key, &stub);
}

Expand Down

0 comments on commit 9c3b08b

Please sign in to comment.