Even more :utf8 socket testing, now in both directions.
[p5sagit/p5-mst-13.2.git] / wince / win32thread.c
1 /* Time-stamp: <01/08/01 21:00:29 keuchel@w2k> */
2
3 #include "EXTERN.h"
4 #include "perl.h"
5
6 #ifdef USE_DECLSPEC_THREAD
7 __declspec(thread) void *PL_current_context = NULL;
8 #endif
9
10 void
11 Perl_set_context(void *t)
12 {
13 #if defined(USE_ITHREADS)
14 #  ifdef USE_DECLSPEC_THREAD
15     Perl_current_context = t;
16 #  else
17     DWORD err = GetLastError();
18     TlsSetValue(PL_thr_key,t);
19     SetLastError(err);
20 #  endif
21 #endif
22 }
23
24 void *
25 Perl_get_context(void)
26 {
27 #if defined(USE_ITHREADS)
28 #  ifdef USE_DECLSPEC_THREAD
29     return Perl_current_context;
30 #  else
31     DWORD err = GetLastError();
32     void *result = TlsGetValue(PL_thr_key);
33     SetLastError(err);
34     return result;
35 #  endif
36 #else
37     return NULL;
38 #endif
39 }