[fpc-devel] volatile variables

Michael Schnell mschnell at lumino.de
Wed Jun 29 15:27:26 CEST 2011


On 06/28/2011 08:09 PM, Hans-Peter Diettrich wrote:
>
>
> When you have a look at TThreadList.LockList/UnlockList, then you'll 
> see that LockList enters the critical section, and UnlockList leaves it. 
Yep This is how a CS works.
> All code executed in between such two calls is absolutely ignorant of 
> the state of the CS, there is no in/outside.
>
The "State" (relevant to this thread) of CS does not change when some 
code of the thread is between enter and leave. So it is not "ignorant" 
but it does know that it "owns" the CS and is the only thread that is 
inside.

(You could say, regarding a certain thread the possible CS states are 
"I'm outside", "I'm inside", and "I'm waiting for entry". The states of 
the CS regarding other threads is not of interest for this thread, other 
that they are known not to be inside if this thread is inside.)

-Michael



More information about the fpc-devel mailing list