Commit | Line | Data |
cb69f87a |
1 | /* Time-stamp: <01/08/01 21:00:29 keuchel@w2k> */ |
e1caacb4 |
2 | |
3 | #include "EXTERN.h" |
4 | #include "perl.h" |
5 | |
e1caacb4 |
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 | { |
3db8f154 |
13 | #if defined(USE_ITHREADS) |
e1caacb4 |
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 | { |
3db8f154 |
27 | #if defined(USE_ITHREADS) |
e1caacb4 |
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 | } |