Skip Menu |
Report information
Id: 1202
Status: rejected
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors:
Cc:
AdminCc:

Operating System: (no value)
PatchStatus: (no value)
Severity: low
Type: 5005threads
Perl Version: (no value)
Fixed In: (no value)



Download (untitled) / with headers
text/plain 1.2k
1. When a thread structure is being removed, the SV which contains it(oursv) needs to be unreferenced. 2. After a thread has been joined the AV which contains the return values should be made mortal - not just each its member when pushed on the stack. *** ext\Thread\Thread.xs~ Tue Aug 10 18:44:12 1999 --- ext\Thread\Thread.xs Tue Aug 10 18:48:47 1999 *************** *** 31,36 **** --- 31,37 ---- PL_nthreads--; t->prev->next = t->next; t->next->prev = t->prev; + SvREFCNT_dec(t->oursv); COND_BROADCAST(&PL_nthreads_cond); MUTEX_UNLOCK(&PL_threads_mutex); #endif *************** *** 379,388 **** } JOIN(t, &av); if (SvTRUE(*av_fetch(av, 0, FALSE))) { /* Could easily speed up the following if necessary */ for (i = 1; i <= AvFILL(av); i++) ! XPUSHs(sv_2mortal(*av_fetch(av, i, FALSE))); } else { STRLEN n_a; char *mess = SvPV(*av_fetch(av, 1, FALSE), n_a); --- 380,391 ---- } JOIN(t, &av); + sv_2mortal((SV*)av); + if (SvTRUE(*av_fetch(av, 0, FALSE))) { /* Could easily speed up the following if necessary */ for (i = 1; i <= AvFILL(av); i++) ! XPUSHs(*av_fetch(av, i, FALSE)); } else { STRLEN n_a; char *mess = SvPV(*av_fetch(av, 1, FALSE), n_a);
Download (untitled) / with headers
text/plain 1.2k
1. After a thread structure has been removed from the thread list the SV which contains it(oursv) is never unreferenced. 2. After a thread has been joined the AV with the return values does not become mortal - just its members when pushed on the stack. Here is the patch: *** ext\Thread\Thread.xs~ Tue Aug 10 18:44:12 1999 --- ext\Thread\Thread.xs Tue Aug 10 18:48:47 1999 *************** *** 31,36 **** --- 31,37 ---- PL_nthreads--; t->prev->next = t->next; t->next->prev = t->prev; + SvREFCNT_dec(t->oursv); COND_BROADCAST(&PL_nthreads_cond); MUTEX_UNLOCK(&PL_threads_mutex); #endif *************** *** 379,388 **** } JOIN(t, &av); if (SvTRUE(*av_fetch(av, 0, FALSE))) { /* Could easily speed up the following if necessary */ for (i = 1; i <= AvFILL(av); i++) ! XPUSHs(sv_2mortal(*av_fetch(av, i, FALSE))); } else { STRLEN n_a; char *mess = SvPV(*av_fetch(av, 1, FALSE), n_a); --- 380,391 ---- } JOIN(t, &av); + sv_2mortal((SV*)av); + if (SvTRUE(*av_fetch(av, 0, FALSE))) { /* Could easily speed up the following if necessary */ for (i = 1; i <= AvFILL(av); i++) ! XPUSHs(*av_fetch(av, i, FALSE)); } else { STRLEN n_a; char *mess = SvPV(*av_fetch(av, 1, FALSE), n_a);
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 117b
5.005 style threads are dead and will likely be removed in 5.10. Please use the new interpreter threads (ithreads).


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org