[Lazarus] thread safe

José Mejuto joshyfun at gmail.com
Wed Jun 29 21:52:57 CEST 2011


Hello Lazarus-List,

Wednesday, June 29, 2011, 5:09:22 PM, you wrote:

>> *** This one must work
>> Thread/core/processor 2
>> -----------------------
>> while true do begin
>>    Critical.Enter;
>>    if a<>b then Raise Exception.Create('KBOOM!');
>>    Critical.Leave;
>> end;
>>
>> If the second one will not work in a n-code processor, or SMP, please
>> tell me why not. Of course the performance will be quite poor.
MS> Did you experience that it does not work ? IMHO that would be really ban
MS> news.

No, exactly the opposite, I do not see how it could fail about memory
order access, cache coherence, ...

-- 
Best regards,
 José





More information about the Lazarus mailing list