>         /* Set the signal for the thread */
>         thread = SV_to_ithread(aTHX_ ST(0));
>         MUTEX_LOCK(&thread->mutex);
>         if (thread->interp) {
>             dTHXa(thread->interp);
>             PL_psig_pend[signal]++;
>             PL_sig_pending = 1;
>         }
>         MUTEX_UNLOCK(&thread->mutex);

Artur Bergman wrote:
> Please humour me and explain to me how that lock is 
> going to protect thread->interp? thread->interp is
> currently running.

The locks protect against thread->interp being freed
while the block is executing.

If you mean that PL_psig_pend[signal], etc. should be
locked:

         /* Set the signal for the thread */
         thread = SV_to_ithread(aTHX_ ST(0));
         MUTEX_LOCK(&thread->mutex);
         if (thread->interp) {
             dTHXa(thread->interp);

             /*** SET A "SIGNAL" LOCK HERE ***/
             PL_psig_pend[signal]++;
             PL_sig_pending = 1;
             /*** UNLOCK HERE ***/

         }
         MUTEX_UNLOCK(&thread->mutex);

then what should the fix be?  Anyone?



Reply via email to