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