*** GMX Spamverdacht *** Re: [fpc-devel] volatile variables

Vinzent Höfler JeLlyFish.software at gmx.net
Wed Jun 29 19:59:29 CEST 2011


On Wed, 29 Jun 2011 16:31:32 +0200, Michael Schnell <mschnell at lumino.de>  
wrote:

> On 06/29/2011 03:17 PM, Nikolai Zhubr wrote:
>>
>> All places where any non-readonly data could be accessed by 2 or more  
>> threads should be protected. Thats it.
> So this is not supposed to work:

Precisely, it is not /guaranteed/ to work if that's what you meant.

(Please also note that "give up time slice" does not mean very much on a
multi-core/CPU system when the threads are running on different cores/CPUs
and thus in "real" parallelity. But I suppose you know that.)

> As assigning a value to myList in one thread is only a very short time  
> before the other thread reads it, it's very likely that the wrong value  
> is still be in the cache of the worker thread's processor and make it  
> crash.
>
> But is is just a very extreme example of a behavior that mostly is  
> assumed to work and according to your wording would be bound to fail.

Ass-U-Me. You know. ;) - Yes, this is bound to fail.


Vinzent.



More information about the fpc-devel mailing list