> Hi Ehsan ,
> Thanks for the below.
>
> If for example I have a global class :
>
> CExample List;
>
> void CExample ::Increase()
> {
> m_Variable++; //this is variable declared in header
> if(m_Variable==20)
> AfxMessageBox("reached..");
> }
>
> void CExample ::SetValue(int Value)
> {
> m_Variable=Value;
> }
>
> The above is just an example, but if my main thread was accessing
> Increase(), and the OnTimer() called Clear(), it seems possible for
> the m_Variable to access the variable the during the Increase routine
> from my main thread. I want to make sure only 1 function is accessed
> at a time,
The OnTimer( ) handlers do *not* interrupt the GUI thread execution.
They're called as part of the message looping, and no such reentrancy
can occur. Of course if CExample objects are accessed from outside the
GUI thread, then you should use normal interthread synchronization
methods.
-------------
Ehsan Akhgari
List Owner: [EMAIL PROTECTED]
[ Email: [EMAIL PROTECTED]; [EMAIL PROTECTED] ]
[ WWW: http://www.beginthread.com/Ehsan ]
With one's principles one seeks to tyrannize over one's habits or to
justify or honour or scold or conceal them - two people with the same
principles probably seek something fundamentally different with them.
-Beyond Good And Evil, F. W. Nietzsche
