diff options
author | Malcolm Beattie <mbeattie@sable.ox.ac.uk> | 1998-02-02 15:51:39 +0000 |
---|---|---|
committer | Malcolm Beattie <mbeattie@sable.ox.ac.uk> | 1998-02-02 15:51:39 +0000 |
commit | 940cb80d04d066d4fedfc4486ab57e435ee74514 (patch) | |
tree | 29bcb5cc4d0e30eb584990d09b0ee5b2ad73cc49 /util.c | |
parent | 5330fa38cab061dceb2210e65e8eccfafbebc694 (diff) | |
download | perl-940cb80d04d066d4fedfc4486ab57e435ee74514.tar.gz |
Introduced thr->threadsvp and THREADSV() for faster per-thread
variables. Moved threadnum to a per-interpreter variable and
made dTHR and lock/unlock of sv_mutex bypass the get/lock unless
more than one thread may be running. Minor tweaks to Thread.xs.
p4raw-id: //depot/perl@453
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 11 |
1 files changed, 4 insertions, 7 deletions
@@ -56,10 +56,6 @@ static void xstat _((void)); #endif -#ifdef USE_THREADS -static U32 threadnum = 0; -#endif /* USE_THREADS */ - #ifndef MYMALLOC /* paranoid version of malloc */ @@ -2443,11 +2439,11 @@ condpair_magic(SV *sv) COND_INIT(&cp->owner_cond); COND_INIT(&cp->cond); cp->owner = 0; - MUTEX_LOCK(&sv_mutex); + LOCK_SV_MUTEX; mg = mg_find(sv, 'm'); if (mg) { /* someone else beat us to initialising it */ - MUTEX_UNLOCK(&sv_mutex); + UNLOCK_SV_MUTEX; MUTEX_DESTROY(&cp->mutex); COND_DESTROY(&cp->owner_cond); COND_DESTROY(&cp->cond); @@ -2458,7 +2454,7 @@ condpair_magic(SV *sv) mg = SvMAGIC(sv); mg->mg_ptr = (char *)cp; mg->mg_len = sizeof(cp); - MUTEX_UNLOCK(&sv_mutex); + UNLOCK_SV_MUTEX; DEBUG_L(WITH_THR(PerlIO_printf(PerlIO_stderr(), "%p: condpair_magic %p\n", thr, sv));) } @@ -2552,6 +2548,7 @@ new_struct_thread(struct perl_thread *t) "new_struct_thread: copied threadsv %d %p->%p\n",i, t, thr)); } } + thr->threadsvp = AvARRAY(thr->threadsv); MUTEX_LOCK(&threads_mutex); nthreads++; |