From a979e76eff22ec19885159cd24149efabbd26455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Wed, 1 Jul 2015 09:45:28 +0200 Subject: [PATCH] win: fix returning thread id in uv_thread_self The main thread does not have the thread id TLS created. Fixes: https://github.com/joyent/node/issues/25602 PR-URL: https://github.com/libuv/libuv/pull/418 Reviewed-By: Alexis Campailla Reviewed-By: Bert Belder --- src/win/thread.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/win/thread.c b/src/win/thread.c index e91ae9b1..d7171fd6 100644 --- a/src/win/thread.c +++ b/src/win/thread.c @@ -191,6 +191,7 @@ int uv_thread_create(uv_thread_t *tid, void (*entry)(void *arg), void *arg) { uv_thread_t uv_thread_self(void) { + uv_once(&uv__current_thread_init_guard, uv__init_current_thread_key); return (uv_thread_t) uv_key_get(&uv__current_thread_key); }