[fpc-devel] volatile variables

Hans-Peter Diettrich DrDiettrich1 at aol.com
Tue Jun 28 18:42:18 CEST 2011


Jonas Maebe schrieb:

>> 2.) Blocking access as described in 4.11 does not address execution 
>> order.
> 
> It does guarantee that if T1 locks the mutex, changes the value, unlocks 
> the mutex [...]

Can you explain please, to what "changes the value" applies?

I could not find a definition of the mutex struct, to determine whether 
it contains any user-alterable values. When "the value" is declared 
outside the mutex struct, it will be accessible also *without* locking 
the mutex first.

However I can imagine that some mutex derived *class* (TCriticalSection) 
can have additional fields, that are inaccessible until some code 
obtains the mutex (similar to TThreadList). Otherwise a mutex cannot 
protect anything but itself.

DoDi




More information about the fpc-devel mailing list