[PATCH] Possible threads race condition in src/alarm.c

Stefan Seifert nine at detonation.org
Sun Sep 9 11:33:52 UTC 2012


On Thursday 30 August 2012 17:34:08 Reini Urban wrote:

> --- a/src/pmc/task.pmc
> +++ b/src/pmc/task.pmc
> @@ -442,7 +442,9 @@ Send a message to this task.
>      METHOD send(PMC *message) {
>          Parrot_Task_attributes * const tdata = PARROT_TASK(SELF);
>          if (PMC_IS_NULL(tdata->mailbox)) {
> +            LOCK(tdata->mailbox_lock);
>              tdata->mailbox = Parrot_pmc_new(interp, enum_class_PMCList);
> +            UNLOCK(tdata->mailbox_lock);
>              PARROT_GC_WRITE_BARRIER(interp, SELF);
>          }

Shouldn't the lock be around the whole if block since the condition is also 
accessing tdata->mailbox?

Stefan


More information about the parrot-dev mailing list