3 * Copyright © 2001 Novell, Inc. All Rights Reserved.
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.
11 * FILENAME : nw5thread.c
12 * DESCRIPTION : Thread related functions.
14 * Date : January 2001.
23 #if defined(PERL_OBJECT)
25 extern CPerlObj* pPerl;
29 //For Thread Local Storage
30 #include "win32ish.h" // For "BOOL", "TRUE" and "FALSE"
33 #ifdef USE_DECLSPEC_THREAD
34 __declspec(thread) void *PL_current_context = NULL;
39 Perl_set_context(void *t)
41 #if defined(USE_THREADS) || defined(USE_ITHREADS)
42 # ifdef USE_DECLSPEC_THREAD
43 Perl_current_context = t;
45 fnAddThreadCtx(PL_thr_key, t);
52 Perl_get_context(void)
54 #if defined(USE_THREADS) || defined(USE_ITHREADS)
55 # ifdef USE_DECLSPEC_THREAD
56 return Perl_current_context;
58 return(fnGetThreadCtx(PL_thr_key));
66 //To Remove the Thread Context stored during Perl_set_context
68 Remove_Thread_Ctx(void)
70 #if defined(USE_THREADS) || defined(USE_ITHREADS)
71 # ifdef USE_DECLSPEC_THREAD
74 return(fnRemoveThreadCtx(PL_thr_key));
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