blob: e99512afbf1fa6e7d33cef513b6b578090cbc2fd (
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
81
82
83
84
85
86
|
/*
* 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"
#if defined(PERL_OBJECT)
#define NO_XSLOCKS
extern CPerlObj* pPerl;
#include "XSUB.h"
#endif
//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_5005THREADS) || 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_5005THREADS) || 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_5005THREADS) || 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
|