blob: abedb5c2da1f237c9b715adbe1e0088247e6dcf1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
/*
* Copyright © 2001 Novell, Inc. All Rights Reserved.
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
*
*/
/*
* FILENAME : nw5thread.c
* DESCRIPTION : Thread related functions.
* Author : SGP
* Date : January 2001.
*
*/
#include "EXTERN.h"
#include "perl.h"
//For Thread Local Storage
#include "win32ish.h" // For "BOOL", "TRUE" and "FALSE"
#include "nwtinfo.h"
#ifdef USE_DECLSPEC_THREAD
__declspec(thread) void *PL_current_context = NULL;
#endif
void
Perl_set_context(void *t)
{
#if defined(USE_ITHREADS)
# ifdef USE_DECLSPEC_THREAD
Perl_current_context = t;
# else
fnAddThreadCtx(PL_thr_key, t);
# endif
#endif
}
void *
Perl_get_context(void)
{
#if defined(USE_ITHREADS)
# ifdef USE_DECLSPEC_THREAD
return Perl_current_context;
# else
return(fnGetThreadCtx(PL_thr_key));
# endif
#else
return NULL;
#endif
}
//To Remove the Thread Context stored during Perl_set_context
BOOL
Remove_Thread_Ctx(void)
{
#if defined(USE_ITHREADS)
# ifdef USE_DECLSPEC_THREAD
return TRUE;
# else
return(fnRemoveThreadCtx(PL_thr_key));
# endif
# else
return TRUE;
#endif
}
//PL_thr_key - Not very sure if this is global or per thread. When multiple scripts
//run simultaneously on NetWare, this will give problems. Hence in nwtinfo.c, the
//current thread id is used as the TLS index & PL_thr_key is not used.
//This has to be checked???? - sgp
|