This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Revert change #22520 (optimise away my $foo = undef and similar
[perl5.git] / wince / win32thread.c
CommitLineData
e1caacb4
JH
1#include "EXTERN.h"
2#include "perl.h"
3
e1caacb4
JH
4#ifdef USE_DECLSPEC_THREAD
5__declspec(thread) void *PL_current_context = NULL;
6#endif
7
8void
9Perl_set_context(void *t)
10{
3db8f154 11#if defined(USE_ITHREADS)
e1caacb4
JH
12# ifdef USE_DECLSPEC_THREAD
13 Perl_current_context = t;
14# else
15 DWORD err = GetLastError();
16 TlsSetValue(PL_thr_key,t);
17 SetLastError(err);
18# endif
19#endif
20}
21
22void *
23Perl_get_context(void)
24{
3db8f154 25#if defined(USE_ITHREADS)
e1caacb4
JH
26# ifdef USE_DECLSPEC_THREAD
27 return Perl_current_context;
28# else
29 DWORD err = GetLastError();
30 void *result = TlsGetValue(PL_thr_key);
31 SetLastError(err);
32 return result;
33# endif
34#else
35 return NULL;
36#endif
37}