ext/threads/t/join.t Testing the join function
ext/threads/t/libc.t testing libc functions for threadsafety
ext/threads/t/list.t Test threads->list()
+ext/threads/t/problems.t Test various memory problems
ext/threads/t/stress_cv.t Test with multiple threads, coderef cv argument.
ext/threads/t/stress_re.t Test with multiple threads, string cv argument and regexes.
ext/threads/t/stress_string.t Test with multiple threads, string cv argument.
}
PUTBACK;
len = call_sv(thread->init_function, thread->gimme|G_EVAL);
+
SPAGAIN;
for (i=len-1; i >= 0; i--) {
SV *sv = POPs;
av_store(params, i, SvREFCNT_inc(sv));
}
- PUTBACK;
if (SvTRUE(ERRSV)) {
Perl_warn(aTHX_ "thread failed to start: %" SVf, ERRSV);
}
AV* params = (AV*) SvRV(thread->params);
CLONE_PARAMS clone_params;
clone_params.stashes = newAV();
+ clone_params.flags |= CLONEf_JOIN_IN;
PL_ptr_table = ptr_table_new();
PERL_THREAD_GETSPECIFIC(self_key,current_thread);
PERL_THREAD_SETSPECIFIC(self_key,thread);
+
+ {
+ I32 len = av_len(params)+1;
+ I32 i;
+ for(i = 0; i < len; i++) {
+ // sv_dump(SvRV(AvARRAY(params)[i]));
+ }
+ }
+
retparam = (AV*) sv_dup((SV*)params, &clone_params);
+ {
+ I32 len = av_len(retparam)+1;
+ I32 i;
+ for(i = 0; i < len; i++) {
+ //sv_dump(SvRV(AvARRAY(retparam)[i]));
+ }
+ }
PERL_THREAD_SETSPECIFIC(self_key,current_thread);
SvREFCNT_dec(clone_params.stashes);
SvREFCNT_inc(retparam);
if (dstr)
return dstr;
+ if(param->flags & CLONEf_JOIN_IN) {
+ /** We are joining here so we don't want do clone
+ something that is bad **/
+
+ if(SvTYPE(sstr) == SVt_PVHV &&
+ HvNAME(sstr)) {
+ /** don't clone stashes if they already exist **/
+ HV* old_stash = gv_stashpv(HvNAME(sstr),0);
+ return (SV*) old_stash;
+ }
+ }
+
/* create anew and remember what it is */
new_SV(dstr);
ptr_table_store(PL_ptr_table, sstr, dstr);
#define CLONEf_COPY_STACKS 1
#define CLONEf_KEEP_PTR_TABLE 2
#define CLONEf_CLONE_HOST 4
+#define CLONEf_JOIN_IN 8
struct clone_params {
AV* stashes;