[Lazarus] thread safe

Andrew Brunner andrew.t.brunner at gmail.com
Tue Jun 28 14:47:41 CEST 2011


On Tue, Jun 28, 2011 at 7:40 AM, Michael Schnell <mschnell at lumino.de> wrote:
> All references I read today say that pthread_mutex (on which supposedly
> TCriticalSection is based) and the appropriate Windows stuff does contain an
> MB. But there might be issues with other OSes and Archs.
>

Yes, any object that requires atomic features will employ a memory barrier.
That is to say the MB is employed in order for the spincount to be
accurate across all cores.

> If they would not do so, the complete plain old threaded application
> paradigm would be invalid, and tons of applications would need to be
> trashed.

> -Michael

Probably right here.  My engine had worked fine on a tripple core AMD.
 It wasn't until I upgraded to the 6 core system did I have to start
looking into what was causing random problems with pointer
assignments.




More information about the Lazarus mailing list