Skip to content

Commit 304c0b4

Browse files
committed
crypto: store thread id as pointer-sized
In https://github.com/MSOpenTech/libuv/commit/59658a8de7cc05a58327a164fd2ed4b050f8b4f4 the return of uv_thread_self() was changed from unsigned long to uv_thread_t. uv_thread_t is a HANDLE (pointer-sized) on Windows, which means that on Win64 it cannot be stored with CRYPTO_THREADID_set_numeric without data loss. Furthermore, without this change there will be a build break on Windows when the libuv change is integrated into Node, because of the conversion from HANDLE to unsigned long. Other related commits: nodejs/node-v0.x-archive@5845a6b https://github.com/MSOpenTech/libuv/commit/919d8ec63ac53566ad1f090058ec15966bd0e960
1 parent cb8cadb commit 304c0b4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/node_crypto.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ template int SSLWrap<TLSCallbacks>::TLSExtStatusCallback(SSL* s, void* arg);
151151

152152

153153
static void crypto_threadid_cb(CRYPTO_THREADID* tid) {
154-
CRYPTO_THREADID_set_numeric(tid, uv_thread_self());
154+
assert(sizeof(uv_thread_t) <= sizeof(void*));
155+
CRYPTO_THREADID_set_pointer(tid, (void*) uv_thread_self());
155156
}
156157

157158

0 commit comments

Comments
 (0)