5 Perl_alloc_thread_key(void)
8 static int key_allocated = 0;
10 if ((thr_key = TlsAlloc()) == TLS_OUT_OF_INDEXES)
11 croak("panic: TlsAlloc");
18 init_thread_intern(struct thread *thr)
21 /* GetCurrentThread() retrurns a pseudo handle, need
22 this to convert it into a handle another thread can use
24 DuplicateHandle(GetCurrentProcess(),
30 DUPLICATE_SAME_ACCESS);
36 Perl_thread_create(struct thread *thr, thread_func_t *fn)
40 MUTEX_LOCK(&thr->mutex);
41 DEBUG_L(PerlIO_printf(PerlIO_stderr(),
42 "%p: create OS thread\n", thr));
43 thr->self = CreateThread(NULL, 0, fn, (void*)thr, 0, &junk);
44 DEBUG_L(PerlIO_printf(PerlIO_stderr(),
45 "%p: OS thread = %p, id=%ld\n", thr, thr->self, junk));
46 MUTEX_UNLOCK(&thr->mutex);
47 return thr->self ? 0 : -1;