summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMalcolm Beattie <mbeattie@sable.ox.ac.uk>1997-10-29 14:39:54 +0000
committerMalcolm Beattie <mbeattie@sable.ox.ac.uk>1997-10-29 14:39:54 +0000
commit46930d8f1568c61dcd2ab37f6a2924dc79596ffc (patch)
tree67e8f7c0f338abbf9de51ffbb7fb9b3377619934
parent25f62d1c923a0e842a23489d92db1990acf9c23b (diff)
downloadperl-46930d8f1568c61dcd2ab37f6a2924dc79596ffc.tar.gz
Remove global macro "self". Change thr->Tself to thr->self.
p4raw-id: //depot/perl@190
-rw-r--r--ext/Thread/Thread.xs3
-rw-r--r--fakethr.h2
-rw-r--r--perl.c2
-rw-r--r--thread.h9
-rw-r--r--win32/win32thread.c6
-rw-r--r--win32/win32thread.h6
6 files changed, 14 insertions, 14 deletions
diff --git a/ext/Thread/Thread.xs b/ext/Thread/Thread.xs
index 24a11df67c..7d309b6a2e 100644
--- a/ext/Thread/Thread.xs
+++ b/ext/Thread/Thread.xs
@@ -256,7 +256,8 @@ char *class;
sigfillset(&fullmask);
if (sigprocmask(SIG_SETMASK, &fullmask, &oldmask) == -1)
croak("panic: sigprocmask");
- err = pthread_create(&self, pthread_attr_default, threadstart, (void*) thr);
+ err = pthread_create(&thr->self, pthread_attr_default,
+ threadstart, (void*) thr);
/* Go */
MUTEX_UNLOCK(&thr->mutex);
#endif
diff --git a/fakethr.h b/fakethr.h
index eaab4b8ca7..e09a757b6d 100644
--- a/fakethr.h
+++ b/fakethr.h
@@ -22,7 +22,7 @@ struct thread_intern {
#define init_thread_intern(t) \
STMT_START { \
- t->Tself = (t); \
+ t->self = (t); \
(t)->i.next_run = (t)->i.prev_run = (t); \
(t)->i.wait_queue = 0; \
(t)->i.private = 0; \
diff --git a/perl.c b/perl.c
index f81689221b..a1dd4e5ce6 100644
--- a/perl.c
+++ b/perl.c
@@ -155,7 +155,7 @@ register PerlInterpreter *sv_interp;
#ifdef HAVE_THREAD_INTERN
init_thread_intern(thr);
#else
- self = pthread_self();
+ thr->self = pthread_self();
if (pthread_key_create(&thr_key, 0))
croak("panic: pthread_key_create");
#endif /* HAVE_THREAD_INTERN */
diff --git a/thread.h b/thread.h
index b92e832f61..fb6a7c05ce 100644
--- a/thread.h
+++ b/thread.h
@@ -13,7 +13,7 @@ typedef pthread_t perl_thread;
# define YIELD pthread_yield()
# define DETACH(t) \
STMT_START { \
- if (pthread_detach(&(t)->Tself)) { \
+ if (pthread_detach(&(t)->self)) { \
MUTEX_UNLOCK(&(t)->mutex); \
croak("panic: DETACH"); \
} \
@@ -83,7 +83,7 @@ typedef pthread_t perl_thread;
#ifndef DETACH
#define DETACH(t) \
STMT_START { \
- if (pthread_detach((t)->Tself)) { \
+ if (pthread_detach((t)->self)) { \
MUTEX_UNLOCK(&(t)->mutex); \
croak("panic: DETACH"); \
} \
@@ -93,7 +93,7 @@ typedef pthread_t perl_thread;
#ifndef JOIN
#define JOIN(t, avp) \
STMT_START { \
- if (pthread_join((t)->Tself, (void**)(avp))) \
+ if (pthread_join((t)->self, (void**)(avp))) \
croak("panic: pthread_join"); \
} STMT_END
#endif /* JOIN */
@@ -198,9 +198,9 @@ struct thread {
/* XXX Sort stuff, firstgv, secongv and so on? */
- perl_thread Tself;
SV * Toursv;
HV * Tcvcache;
+ perl_thread self; /* Underlying thread object */
U32 flags;
perl_mutex mutex; /* For the fields others can change */
U32 tid;
@@ -285,7 +285,6 @@ typedef struct condpair {
#undef dirty
#undef localizing
-#define self (thr->Tself)
#define oursv (thr->Toursv)
#define stack_base (thr->Tstack_base)
#define stack_sp (thr->Tstack_sp)
diff --git a/win32/win32thread.c b/win32/win32thread.c
index e74d7e8933..9f63d178f4 100644
--- a/win32/win32thread.c
+++ b/win32/win32thread.c
@@ -8,7 +8,7 @@ init_thread_intern(struct thread *thr)
DuplicateHandle(GetCurrentProcess(),
GetCurrentThread(),
GetCurrentProcess(),
- &self,
+ &thr->self,
0,
FALSE,
DUPLICATE_SAME_ACCESS);
@@ -24,7 +24,7 @@ thread_create(struct thread *thr, THREAD_RET_TYPE (*fn)(void *))
DWORD junk;
MUTEX_LOCK(&thr->mutex);
- self = CreateThread(NULL, 0, fn, (void*)thr, 0, &junk);
+ thr->self = CreateThread(NULL, 0, fn, (void*)thr, 0, &junk);
MUTEX_UNLOCK(&thr->mutex);
- return self ? 0 : -1;
+ return thr->self ? 0 : -1;
}
diff --git a/win32/win32thread.h b/win32/win32thread.h
index 46e0a58fb6..ab0dbc598f 100644
--- a/win32/win32thread.h
+++ b/win32/win32thread.h
@@ -72,7 +72,7 @@ typedef HANDLE perl_thread;
#define DETACH(t) \
STMT_START { \
- if (CloseHandle((t)->Tself) == 0) { \
+ if (CloseHandle((t)->self) == 0) { \
MUTEX_UNLOCK(&(t)->mutex); \
croak("panic: DETACH"); \
} \
@@ -84,8 +84,8 @@ typedef HANDLE perl_thread;
#define JOIN(t, avp) \
STMT_START { \
- if ((WaitForSingleObject((t)->Tself,INFINITE) == WAIT_FAILED) \
- || (GetExitCodeThread((t)->Tself,(LPDWORD)(avp)) == 0)) \
+ if ((WaitForSingleObject((t)->self,INFINITE) == WAIT_FAILED) \
+ || (GetExitCodeThread((t)->self,(LPDWORD)(avp)) == 0)) \
croak("panic: JOIN"); \
} STMT_END