summaryrefslogtreecommitdiff
path: root/NetWare/nw5thread.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-06-16 19:46:38 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-06-16 19:46:38 +0000
commit2986a63f7e513cf37f46db9f211b77071260031f (patch)
tree9a6e62602396938ea5a612420f53ebf267e8d941 /NetWare/nw5thread.c
parent87b11a197a59fac210fc9265bde0ef1ffe36de89 (diff)
downloadperl-2986a63f7e513cf37f46db9f211b77071260031f.tar.gz
NetWare port from Guruprasad S <SGURUPRASAD@novell.com>.
p4raw-id: //depot/perl@10643
Diffstat (limited to 'NetWare/nw5thread.c')
-rw-r--r--NetWare/nw5thread.c86
1 files changed, 86 insertions, 0 deletions
diff --git a/NetWare/nw5thread.c b/NetWare/nw5thread.c
new file mode 100644
index 0000000000..5cfa1801fc
--- /dev/null
+++ b/NetWare/nw5thread.c
@@ -0,0 +1,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_THREADS) || 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_THREADS) || 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_THREADS) || 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
+