This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Bump Data::Dumper version
[perl5.git] / win32 / win32thread.c
CommitLineData
ea0efc06
MB
1#include "EXTERN.h"
2#include "perl.h"
d55594ae 3
c69f112c 4#ifdef USE_DECLSPEC_THREAD
ba869deb 5__declspec(thread) void *PL_current_context = NULL;
c69f112c 6#endif
9811a7d7
NIS
7
8void
ba869deb 9Perl_set_context(void *t)
9811a7d7 10{
3db8f154 11#if defined(USE_ITHREADS)
ba869deb
GS
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
4c36ecb7 19#endif
9811a7d7
NIS
20}
21
ba869deb
GS
22void *
23Perl_get_context(void)
9811a7d7 24{
3db8f154 25#if defined(USE_ITHREADS)
ba869deb
GS
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
4c36ecb7 34#else
ba869deb 35 return NULL;
4c36ecb7 36#endif
9811a7d7 37}