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 /* Set thr->self. 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);
31 /* XXX init thr->i here */
37 Perl_thread_create(struct thread *thr, thread_func_t *fn)
41 MUTEX_LOCK(&thr->mutex);
42 DEBUG_L(PerlIO_printf(PerlIO_stderr(),
43 "%p: create OS thread\n", thr));
44 thr->self = CreateThread(NULL, 0, fn, (void*)thr, 0, &junk);
45 DEBUG_L(PerlIO_printf(PerlIO_stderr(),
46 "%p: OS thread = %p, id=%ld\n", thr, thr->self, junk));
47 MUTEX_UNLOCK(&thr->mutex);
48 return thr->self ? 0 : -1;