[fpc-devel] volatile variables
mschnell at lumino.de
Thu Jun 30 14:26:39 CEST 2011
On 06/30/2011 11:52 AM, Jonas Maebe wrote:
> On 30 Jun 2011, at 10:38, Michael Schnell wrote:
>> Regarding FPC, TCriticalSection is a decent encapsulation for
>> pthread_mutex_... when used in this way.
>> But e.g. if you use a TThreadList instance "myList" with multiple
>> threads it can't be the way to go to include any occurrence of
>> myList.xxx by a critical section just to make sure that the cache
>> synchronization has happened and the instance variable itself in fact
>> is valid.
> That's where optimization comes in,
Very wrong assumption.
Optimization is not the question here it's just working vs. not working.
In a previous post the claim was that if the variable is not in the
cache of the appropriate CPU, a cache synchronization is not
automatically done by the underling system (Hardware / OS / Libraries)
and thus the variable has an erroneous value unless the application
program uses some special means to provide coherency.
In fact I doubt this, but this was the claim and thus needs to be
More information about the fpc-devel