[fpc-devel] volatile variables

Henry Vermaak henry.vermaak at gmail.com
Tue Jun 28 15:15:42 CEST 2011


On 28/06/11 14:00, Jonas Maebe wrote:
>
> On 28 Jun 2011, at 14:58, Andrew Brunner wrote:
>
>> On Tue, Jun 28, 2011 at 6:14 AM, Michael Schnell <mschnell at lumino.de>
>> wrote:
>>
>>> For variables not defined as volatile, (e.g.) pthread_mutex (and similar
>>> stuff on Windows) can be used to protect them.
>>>
>> A mutex may be able to atomically block access because of its own
>> memory barrier, but I would suggest that employing such a technique on
>> multi-core systems will not ensure an accurate value.
>
> pthread_mutex() does guarantee that. I don't know about the Windows
> equivalents.

I've found this earlier:

http://msdn.microsoft.com/en-us/library/ms686355%28v=VS.85%29.aspx

Henry



More information about the fpc-devel mailing list