[webkit-dev] Atomic read/write operations and thread safety

Steve Block steveblock at google.com
Wed Dec 15 11:24:41 PST 2010


>>> The boolean in question isn't both checked and set at the same time - it's not an acquired resource.  One
>>> thread sets it, the other checks it.
>> I don't follow. If it's set from one thread and checked from another
>> thread without locks, how can you guarantee this (other than with
>> application logic)?
> I don't understand your question - "how can you guarantee this?"
I meant 'how can you guarantee that the boolean isn't both checked and
set at the same time, given that you don't use locks'. But it looks
like you're saying that this is guaranteed by higher-level application
logic, as you describe below.

> It doesn't matter if it's written and read at the same time in this case - but after every write on the main
> thread, the background thread is signaled to read, so that read will always happen after the write.
OK, makes sense.

Thanks,
Steve


More information about the webkit-dev mailing list