#include "EXTERN.h"
#include "perl.h"
+__declspec(thread) struct thread *current_thread;
+
+void
+Perl_setTHR(struct thread *t)
+{
+ current_thread = t;
+}
+
+struct thread *
+Perl_getTHR(void)
+{
+ return current_thread;
+}
+
void
Perl_alloc_thread_key(void)
{
} \
} STMT_END
-#define THR ((struct thread *) TlsGetValue(thr_key))
+
+#define THR Perl_getTHR()
#define THREAD_CREATE(t, f) Perl_thread_create(t, f)
#define THREAD_POST_CREATE(t) NOOP
#define THREAD_RET_TYPE DWORD WINAPI
void Perl_alloc_thread_key _((void));
int Perl_thread_create _((struct thread *thr, thread_func_t *fn));
void Perl_set_thread_self _((struct thread *thr));
+struct thread *Perl_getTHR _((void));
+void Perl_setTHR _((struct thread *t));
END_EXTERN_C
#define INIT_THREADS NOOP
croak("panic: JOIN"); \
} STMT_END
-#define SET_THR(t) \
- STMT_START { \
- if (TlsSetValue(thr_key, (void *) (t)) == 0) \
- croak("panic: TlsSetValue"); \
- } STMT_END
-
+#define SET_THR(t) Perl_setTHR(t)
#define YIELD Sleep(0)
#endif /* _WIN32THREAD_H */