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

Reini Urban rurban at x-ray.at
Sun Sep 9 21:57:40 UTC 2012


On Sun, Sep 9, 2012 at 6:33 AM, Stefan Seifert <nine at detonation.org> wrote:
> 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?

Oops, sure. Some days I am blind.
-- 
Reini Urban
http://cpanel.net/   http://www.perl-compiler.org/


More information about the parrot-dev mailing list