[fpc-pascal]two questions plz help
Jonas Maebe
jonas at zeus.rug.ac.be
Wed Jan 16 13:47:33 CET 2002
On woensdag, januari 16, 2002, at 12:57 , Stefan Ziegenbalg wrote:
>> This isn't MT-safe at all. If two threads are in the "while lock_mem do
>> delay(1);" loop, it's possible that when something else sets it to
>> false, they both check it before the other one has set it to true. You
>> need to do the testing and setting as an atomic operation.
>
> But the probability of that event is very low.
But it will cause sporadic and very hard to trace crashes. There's no
use in making something "almost thread safe" :)
Jonas
More information about the fpc-pascal
mailing list