summaryrefslogtreecommitdiff
path: root/os2
diff options
context:
space:
mode:
authorIlya Zakharevich <ilya@math.berkeley.edu>1998-04-03 20:39:03 -0500
committerMalcolm Beattie <mbeattie@sable.ox.ac.uk>1998-05-14 14:47:29 +0000
commit3aefca0416eab0f2104345964c03107793baf1d6 (patch)
tree5203fb60a3e6c05dd90a6fe0ce19d84517b07b61 /os2
parentecbaadc1f9d5bbebf204a971c75e312b0e7fa9ae (diff)
downloadperl-3aefca0416eab0f2104345964c03107793baf1d6.tar.gz
[PATCH 5.004_64] anydbm.t
Date: Sat, 4 Apr 1998 01:39:03 -0500 (EST) Subject: [PATCH 5.004_64] threads on OS/2 Date: Sat, 4 Apr 1998 01:44:29 -0500 (EST) Subject: [PATCH 5.004_64] Better handling of Perl DLLs under OS/2 Date: Sat, 4 Apr 1998 01:47:58 -0500 (EST) Subject: [PATCH 5.004_64] Immediate stop in debugger Date: Sat, 11 Apr 1998 19:50:58 -0400 (EDT) Subject: [PATCH 5.005_64] ptags broken Date: Sat, 11 Apr 1998 22:08:21 -0400 (EDT) Subject: [PATCH 5.004_64] Document switch syntax via RE Date: Sun, 12 Apr 1998 01:12:33 -0400 (EDT) p4raw-id: //depot/perl@941
Diffstat (limited to 'os2')
-rw-r--r--os2/Changes4
-rw-r--r--os2/Makefile.SHs24
-rw-r--r--os2/os2.c15
-rw-r--r--os2/os2thread.h16
4 files changed, 42 insertions, 17 deletions
diff --git a/os2/Changes b/os2/Changes
index a46b7a52a4..344939c891 100644
--- a/os2/Changes
+++ b/os2/Changes
@@ -166,3 +166,7 @@ after 5.004_03:
after 5.004_53:
Minimal thread support added. One needs to manually move pthread.h
+
+after 5.004_64:
+ Make DLL names different if thread-enabled.
+ Emit more informative internal DLL descriptions.
diff --git a/os2/Makefile.SHs b/os2/Makefile.SHs
index 57d42602e9..4ba7a7fd1f 100644
--- a/os2/Makefile.SHs
+++ b/os2/Makefile.SHs
@@ -6,8 +6,17 @@
# Additional rules supported: perl_, aout_test, aout_install, use them
# for a.out style perl (which may fork).
+perl_version="5.00${PATCHLEVEL}_$SUBVERSION"
+case "$archname" in
+ *-thread) dll_post=_thr
+ perl_version="${perl_version}-threaded";;
+ *) dll_post='' ;;
+esac
+
$spitshell >>Makefile <<!GROK!THIS!
+PERL_VERSION = $perl_version
+
AOUT_OPTIMIZE = $optimize
AOUT_CCCMD = \$(CC) $aout_ccflags \$(AOUT_OPTIMIZE)
AOUT_AR = $aout_ar
@@ -22,13 +31,16 @@ AOUT_CLDFLAGS_DLL = -Zexe -Zmt -Zcrtdll
LD_OPT = $optimize
+PERL_DLL_BASE = perl$dll_post
+PERL_DLL = \$(PERL_DLL_BASE)\$(DLSUFFIX)
+
!GROK!THIS!
$spitshell >>Makefile <<'!NO!SUBS!'
-$(LIBPERL): perl.imp perl.dll perl5.def
+$(LIBPERL): perl.imp $(PERL_DLL) perl5.def
emximp -o $(LIBPERL) perl.imp
-$(AOUT_LIBPERL_DLL): perl.imp perl.dll perl5.def
+$(AOUT_LIBPERL_DLL): perl.imp $(PERL_DLL) perl5.def
emximp -o $(AOUT_LIBPERL_DLL) perl.imp
perl.imp: perl5.def
@@ -38,12 +50,12 @@ perl.imp: perl5.def
echo 'emx_malloc emxlibcm 402 ?' >> $@
echo 'emx_realloc emxlibcm 403 ?' >> $@
-perl.dll: $(obj) perl5.def perl$(OBJ_EXT)
+$(PERL_DLL): $(obj) perl5.def perl$(OBJ_EXT)
$(LD) $(LD_OPT) $(LDDLFLAGS) -o $@ perl$(OBJ_EXT) $(obj) $(libs) perl5.def
perl5.def: perl.linkexp
- echo "LIBRARY 'Perl' INITINSTANCE TERMINSTANCE" > $@
- echo DESCRIPTION "'Perl interpreter, export autogenerated'" >>$@
+ echo "LIBRARY '$(PERL_DLL_BASE)' INITINSTANCE TERMINSTANCE" > $@
+ echo DESCRIPTION "'Perl interpreter v$(PERL_VERSION), export autogenerated'" >>$@
echo STACKSIZE 32768 >>$@
echo CODE LOADONCALL >>$@
echo DATA LOADONCALL NONSHARED MULTIPLE >>$@
@@ -68,7 +80,7 @@ perl.exports: perl.exp EXTERN.h perl.h
$(CC) -DEMBED -E - | \
awk '{if ($$2 == "") print $$1}' | sort | uniq > $@
-perl.linkexp: perl.exports perl.map
+perl.linkexp: perl.exports perl.map os2/os2.sym
cat perl.exports os2/os2.sym perl.map | sort | uniq -d | sed -e 's/\w\+/ "\0"/' > perl.linkexp
# We link miniperl statically, since .DLL depends on $(DYNALOADER)
diff --git a/os2/os2.c b/os2/os2.c
index f24c3af5ce..cb8373629f 100644
--- a/os2/os2.c
+++ b/os2/os2.c
@@ -40,16 +40,16 @@ const char *pthreads_states[] = {
typedef struct {
void *status;
- pthread_cond_t cond;
+ perl_cond cond;
enum pthreads_state state;
} thread_join_t;
thread_join_t *thread_join_data;
int thread_join_count;
-pthread_mutex_t start_thread_mutex;
+perl_mutex start_thread_mutex;
int
-pthread_join(pthread_t tid, void **status)
+pthread_join(perl_os_thread tid, void **status)
{
MUTEX_LOCK(&start_thread_mutex);
switch (thread_join_data[tid].state) {
@@ -117,7 +117,7 @@ pthread_startit(void *arg)
}
int
-pthread_create(pthread_t *tid, const pthread_attr_t *attr,
+pthread_create(perl_os_thread *tid, const pthread_attr_t *attr,
void *(*start_routine)(void*), void *arg)
{
void *args[2];
@@ -134,7 +134,7 @@ pthread_create(pthread_t *tid, const pthread_attr_t *attr,
}
int
-pthread_detach(pthread_t tid)
+pthread_detach(perl_os_thread tid)
{
MUTEX_LOCK(&start_thread_mutex);
switch (thread_join_data[tid].state) {
@@ -157,7 +157,7 @@ pthread_detach(pthread_t tid)
/* This is a very bastardized version: */
int
-os2_cond_wait(pthread_cond_t *c, pthread_mutex_t *m)
+os2_cond_wait(perl_cond *c, perl_mutex *m)
{
int rc;
if ((rc = DosResetEventSem(*c,&na)) && (rc != ERROR_ALREADY_RESET))
@@ -881,6 +881,9 @@ mod2fname(sv)
}
avlen --;
}
+#ifdef USE_THREADS
+ sum++; /* Avoid conflict of DLLs in memory. */
+#endif
fname[pos] = 'A' + (sum % 26);
fname[pos + 1] = 'A' + (sum / 26 % 26);
fname[pos + 2] = '\0';
diff --git a/os2/os2thread.h b/os2/os2thread.h
index 44dec3f244..d56fe160dd 100644
--- a/os2/os2thread.h
+++ b/os2/os2thread.h
@@ -1,10 +1,16 @@
#include <sys/builtin.h>
#include <sys/fmutex.h>
#include <sys/rmutex.h>
-typedef int pthread_t;
-typedef _rmutex pthread_mutex_t;
-/*typedef HEV pthread_cond_t;*/
-typedef unsigned long pthread_cond_t;
-typedef int pthread_key_t;
+typedef int perl_os_thread;
+
+typedef _rmutex perl_mutex;
+
+/*typedef HEV perl_cond;*/ /* Will include os2.h into all C files. */
+typedef unsigned long perl_cond;
+
+typedef int perl_key;
+
typedef unsigned long pthread_attr_t;
#define PTHREADS_INCLUDED
+#define pthread_attr_init(arg) 0
+#define pthread_attr_setdetachstate(arg1,arg2) 0