[fpc-devel] volatile variables

Michael Schnell mschnell at lumino.de
Thu Jun 30 10:38:18 CEST 2011

On 06/29/2011 09:00 PM, Vinzent Höfler wrote:
> POSIX: pthread_mutex_(un)lock() & Co.
> Or, maybe I didn't understand the question...
I suppose, you did understand what I intended to say.

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 

Moreover I don't think it can be the way to go to enforce the 
application programmer to plan his software in a way that somehow else 
he needs to make sure that such an instance variable arrives in the 
appropriate CPU's cache.

So I do hope that the constructors of the hardware, the OS and the 
libraries already somehow did take care of this issue O:-) ,


More information about the fpc-devel mailing list