[fpc-devel] volatile variables

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


Michael Schnell schrieb:

> Only the ordering decision "inside" vs "outside" of the critical section 
> is necessary for threaded user application. If both Enter and Leave do a 
> "full fence" barrier, I suppose we are safe.

Since the condition is only stored *inside* the CS or mutex, no other 
code will know about it, unless it *explicitly* queries the state of the 
object.

When you have a look at TThreadList.LockList/UnlockList, then you'll see 
that LockList enters the critical section, and UnlockList leaves it. All 
code executed in between such two calls is absolutely ignorant of the 
state of the CS, there is no in/outside.

DoDi




More information about the fpc-devel mailing list