summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>1997-11-15 20:42:28 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>1997-11-15 20:42:28 +0000
commit0fefa03b970ac01e359bb69c9e4daaddc57f3db9 (patch)
tree04834a71c6704df1a6a5d2cfcdd013c05cc96857
parent9811a7d768316e95d4f07bb4877adaf9834ec499 (diff)
downloadperl-0fefa03b970ac01e359bb69c9e4daaddc57f3db9.tar.gz
Implement dTHR via __declspec(thread) - part 2
p4raw-id: //depot/ansiperl@258
-rw-r--r--win32/makedef.pl2
-rw-r--r--win32/win32thread.c6
-rw-r--r--win32/win32thread.h17
3 files changed, 18 insertions, 7 deletions
diff --git a/win32/makedef.pl b/win32/makedef.pl
index 3ec9b82f68..03a42395ce 100644
--- a/win32/makedef.pl
+++ b/win32/makedef.pl
@@ -402,6 +402,6 @@ win32_open_osfhandle
win32_get_osfhandle
Perl_win32_init
Perl_init_os_extras
-Perl_setTHR
Perl_getTHR
+Perl_setTHR
RunPerl
diff --git a/win32/win32thread.c b/win32/win32thread.c
index eefa92c385..c0c3c60239 100644
--- a/win32/win32thread.c
+++ b/win32/win32thread.c
@@ -1,18 +1,18 @@
#include "EXTERN.h"
#include "perl.h"
-__declspec(thread) struct thread *current_thread;
+__declspec(thread) struct thread *Perl_current_thread = NULL;
void
Perl_setTHR(struct thread *t)
{
- current_thread = t;
+ Perl_current_thread = t;
}
struct thread *
Perl_getTHR(void)
{
- return current_thread;
+ return Perl_current_thread;
}
void
diff --git a/win32/win32thread.h b/win32/win32thread.h
index 6af548d30a..1807f3bc46 100644
--- a/win32/win32thread.h
+++ b/win32/win32thread.h
@@ -98,7 +98,6 @@ typedef HANDLE perl_mutex;
} STMT_END
-#define THR Perl_getTHR()
#define THREAD_CREATE(t, f) Perl_thread_create(t, f)
#define THREAD_POST_CREATE(t) NOOP
#define THREAD_RET_TYPE DWORD WINAPI
@@ -106,16 +105,28 @@ typedef HANDLE perl_mutex;
typedef THREAD_RET_TYPE thread_func_t(void *);
+
START_EXTERN_C
+
+#ifdef PERLDLL
+extern __declspec(thread) struct thread *Perl_current_thread;
+#define SET_THR(t) (Perl_current_thread = t)
+#define THR Perl_current_thread
+#else
+#define THR Perl_getTHR()
+#define SET_THR(t) Perl_setTHR(t)
+#endif
+
void Perl_alloc_thread_key _((void));
int Perl_thread_create _((struct thread *thr, thread_func_t *fn));
void Perl_set_thread_self _((struct thread *thr));
struct thread *Perl_getTHR _((void));
void Perl_setTHR _((struct thread *t));
+
END_EXTERN_C
#define INIT_THREADS NOOP
-#define ALLOC_THREAD_KEY Perl_alloc_thread_key()
+#define ALLOC_THREAD_KEY NOOP
#define SET_THREAD_SELF(thr) Perl_set_thread_self(thr)
#define JOIN(t, avp) \
@@ -125,7 +136,7 @@ END_EXTERN_C
croak("panic: JOIN"); \
} STMT_END
-#define SET_THR(t) Perl_setTHR(t)
#define YIELD Sleep(0)
#endif /* _WIN32THREAD_H */
+