summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorMalcolm Beattie <mbeattie@sable.ox.ac.uk>1997-10-15 16:57:45 +0000
committerMalcolm Beattie <mbeattie@sable.ox.ac.uk>1997-10-15 16:57:45 +0000
commitc7848ba184fac8eca4125f4296d6e09fee2c1846 (patch)
treeb3622e9e800badf79382bfc95e96ea8cd2733b5a /util.c
parentf826a10b5944692b2da706f4a0ac5056f28e8c6d (diff)
downloadperl-c7848ba184fac8eca4125f4296d6e09fee2c1846.tar.gz
Finish thread state machine: fixes global destruction of threads,
detaching, joining etc. Alter FAKE_THREADS-specific fields to use new HAVE_THREAD_INTERN stuff. Updates docs. Various fixes to Thread.xs. p4raw-id: //depot/perl@131
Diffstat (limited to 'util.c')
-rw-r--r--util.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/util.c b/util.c
index 560ec7db04..540181cdeb 100644
--- a/util.c
+++ b/util.c
@@ -2355,7 +2355,7 @@ I32 *retlen;
void
schedule(void)
{
- thr = thr->next_run;
+ thr = thr->i.next_run;
}
void
@@ -2376,11 +2376,11 @@ perl_cond *cp;
return;
t = cond->thread;
/* Insert t in the runnable queue just ahead of us */
- t->next_run = thr->next_run;
- thr->next_run->prev_run = t;
- t->prev_run = thr;
- thr->next_run = t;
- thr->wait_queue = 0;
+ t->i.next_run = thr->i.next_run;
+ thr->i.next_run->i.prev_run = t;
+ t->i.prev_run = thr;
+ thr->i.next_run = t;
+ thr->i.wait_queue = 0;
/* Remove from the wait queue */
*cp = cond->next;
Safefree(cond);
@@ -2396,11 +2396,11 @@ perl_cond *cp;
for (cond = *cp; cond; cond = cond_next) {
t = cond->thread;
/* Insert t in the runnable queue just ahead of us */
- t->next_run = thr->next_run;
- thr->next_run->prev_run = t;
- t->prev_run = thr;
- thr->next_run = t;
- thr->wait_queue = 0;
+ t->i.next_run = thr->i.next_run;
+ thr->i.next_run->i.prev_run = t;
+ t->i.prev_run = thr;
+ thr->i.next_run = t;
+ thr->i.wait_queue = 0;
/* Remove from the wait queue */
cond_next = cond->next;
Safefree(cond);
@@ -2414,17 +2414,17 @@ perl_cond *cp;
{
perl_cond cond;
- if (thr->next_run == thr)
+ if (thr->i.next_run == thr)
croak("panic: perl_cond_wait called by last runnable thread");
New(666, cond, 1, struct perl_wait_queue);
cond->thread = thr;
cond->next = *cp;
*cp = cond;
- thr->wait_queue = cond;
+ thr->i.wait_queue = cond;
/* Remove ourselves from runnable queue */
- thr->next_run->prev_run = thr->prev_run;
- thr->prev_run->next_run = thr->next_run;
+ thr->i.next_run->i.prev_run = thr->i.prev_run;
+ thr->i.prev_run->i.next_run = thr->i.next_run;
}
#endif /* FAKE_THREADS */
@@ -2473,9 +2473,7 @@ SV *sv;
mg->mg_len = sizeof(cp);
MUTEX_UNLOCK(&sv_mutex);
DEBUG_L(WITH_THR(PerlIO_printf(PerlIO_stderr(),
- "0x%lx: condpair_magic 0x%lx\n",
- (unsigned long)thr,
- (unsigned long)sv));)
+ "%p: condpair_magic %p\n", thr, sv));)
}
}
return mg;