Change pp_lock to take a reference instead of a
[p5sagit/p5-mst-13.2.git] / ext / threads / threads.xs
index 4173299..5bcf4e4 100755 (executable)
@@ -131,7 +131,6 @@ Perl_ithread_destruct (pTHX_ ithread* thread, const char *why)
            destroyperl = thread->interp;
            thread->interp = NULL;
        }
-       PERL_SET_CONTEXT(aTHX);
        MUTEX_UNLOCK(&thread->mutex);
        MUTEX_DESTROY(&thread->mutex);
         PerlMemShared_free(thread);
@@ -139,6 +138,7 @@ Perl_ithread_destruct (pTHX_ ithread* thread, const char *why)
            perl_destruct(destroyperl);
             perl_free(destroyperl);
        }
+       PERL_SET_CONTEXT(aTHX);
 }
 
 int
@@ -386,7 +386,7 @@ Perl_ithread_create(pTHX_ SV *obj, char* classname, SV* init_function, SV* param
        thread->interp = perl_clone(aTHX, CLONEf_KEEP_PTR_TABLE);
 #endif
        /* perl_clone leaves us in new interpreter's context.
-          As it is tricky to spot implcit aTHX create a new scope
+          As it is tricky to spot an implicit aTHX, create a new scope
           with aTHX matching the context for the duration of
           our work for new interpreter.
         */