summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>1997-11-29 01:35:45 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>1997-11-29 01:35:45 +0000
commitc69f112c145fabe210a7e2c5c2406baeea71af2f (patch)
treef99acaeffc5cdd4e8b5cd9931d8e74da85deb578 /win32
parent900941544544b9ca5ecbb5e1f24f9c23b3635b68 (diff)
downloadperl-c69f112c145fabe210a7e2c5c2406baeea71af2f.tar.gz
GCC + Threads on Win32 - best gcc results yet
p4raw-id: //depot/ansiperl@331
Diffstat (limited to 'win32')
-rw-r--r--win32/makedef.pl5
-rw-r--r--win32/makegcc.mk2
-rw-r--r--win32/win32.h9
-rw-r--r--win32/win32iop.h7
-rw-r--r--win32/win32thread.c10
-rw-r--r--win32/win32thread.h5
6 files changed, 28 insertions, 10 deletions
diff --git a/win32/makedef.pl b/win32/makedef.pl
index d87cbedac2..87f1d93a3e 100644
--- a/win32/makedef.pl
+++ b/win32/makedef.pl
@@ -159,6 +159,11 @@ Perl_cshname
Perl_opsave
!END!OF!SKIP!
+if ($CCTYPE eq 'GCC')
+ {
+ $skip_sym .= "Perl_na\n";
+ }
+
if ($define{'MYMALLOC'})
{
$skip_sym .= <<'!END!OF!SKIP!';
diff --git a/win32/makegcc.mk b/win32/makegcc.mk
index a6c574e32a..dfe372c935 100644
--- a/win32/makegcc.mk
+++ b/win32/makegcc.mk
@@ -11,7 +11,7 @@
# newly built perl.
INST_DRV=c:
INST_TOP=$(INST_DRV)\perl5004.5x
-#BUILDOPT=-DUSE_THREADS
+BUILDOPT=-DUSE_THREADS
#
diff --git a/win32/win32.h b/win32/win32.h
index 791d92a405..93b74efd3f 100644
--- a/win32/win32.h
+++ b/win32/win32.h
@@ -15,6 +15,8 @@ typedef long long __int64;
#define Win32_Winsock
#endif
+
+
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -33,6 +35,13 @@ typedef long long __int64;
#include "EXTERN.h"
#endif
+struct tms {
+ long tms_utime;
+ long tms_stime;
+ long tms_cutime;
+ long tms_cstime;
+};
+
#ifndef START_EXTERN_C
#ifdef __cplusplus
# define START_EXTERN_C extern "C" {
diff --git a/win32/win32iop.h b/win32/win32iop.h
index ccc1a65218..a2b318a558 100644
--- a/win32/win32iop.h
+++ b/win32/win32iop.h
@@ -30,13 +30,6 @@
*/
START_EXTERN_C
-struct tms {
- long tms_utime;
- long tms_stime;
- long tms_cutime;
- long tms_cstime;
-};
-
EXT int * win32_errno(void);
EXT char *** win32_environ(void);
EXT FILE* win32_stdin(void);
diff --git a/win32/win32thread.c b/win32/win32thread.c
index 039f8b4b6f..d62dadd1e3 100644
--- a/win32/win32thread.c
+++ b/win32/win32thread.c
@@ -1,18 +1,28 @@
#include "EXTERN.h"
#include "perl.h"
+#ifdef USE_DECLSPEC_THREAD
__declspec(thread) struct perl_thread *Perl_current_thread = NULL;
+#endif
void
Perl_setTHR(struct perl_thread *t)
{
+#ifdef USE_DECLSPEC_THREAD
Perl_current_thread = t;
+#else
+ TlsSetValue(thr_key,t);
+#endif
}
struct perl_thread *
Perl_getTHR(void)
{
+#ifdef USE_DECLSPEC_THREAD
return Perl_current_thread;
+#else
+ return (struct perl_thread *) TlsGetValue(thr_key);
+#endif
}
void
diff --git a/win32/win32thread.h b/win32/win32thread.h
index 591184b007..6f355f09eb 100644
--- a/win32/win32thread.h
+++ b/win32/win32thread.h
@@ -108,7 +108,7 @@ typedef THREAD_RET_TYPE thread_func_t(void *);
START_EXTERN_C
-#if defined(PERLDLL) && (!defined(__BORLANDC__) || defined(_DLL))
+#if defined(PERLDLL) && defined(USE_DECLSPEC_THREAD) && (!defined(__BORLANDC__) || defined(_DLL))
extern __declspec(thread) struct perl_thread *Perl_current_thread;
#define SET_THR(t) (Perl_current_thread = t)
#define THR Perl_current_thread
@@ -116,6 +116,7 @@ extern __declspec(thread) struct perl_thread *Perl_current_thread;
#define THR Perl_getTHR()
#define SET_THR(t) Perl_setTHR(t)
#endif
+struct perl_thread;
void Perl_alloc_thread_key _((void));
int Perl_thread_create _((struct perl_thread *thr, thread_func_t *fn));
@@ -126,7 +127,7 @@ void Perl_setTHR _((struct perl_thread *t));
END_EXTERN_C
#define INIT_THREADS NOOP
-#define ALLOC_THREAD_KEY NOOP
+#define ALLOC_THREAD_KEY Perl_alloc_thread_key()
#define SET_THREAD_SELF(thr) Perl_set_thread_self(thr)
#define JOIN(t, avp) \