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 <alexis@janeasystems.com>
Reviewed-By: Bert Belder <bertbelder@gmail.com>
This commit is contained in:
Saúl Ibarra Corretgé 2015-07-01 09:45:28 +02:00
parent 7980f1359d
commit a979e76eff

View File

@ -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);
}