==================================================
Message: 7
Subject: Re: IllegalLockException
From: Jonathan Johnson <[EMAIL PROTECTED]>
Date: Fri, 17 Mar 2006 10:52:30 -0600
On Mar 16, 2006, at 11:19 PM, a.zatsepin wrote:
Hi all.
In MyWindow I add Property MyCriticalSection.
In thread I call MyWindow.MyCriticalSection.Enter (or TryEnter) and
after that MyWindow.MyCriticalSection.Leave.
Sometimes CriticalSection.Leave threw exception
IllegalLockException. Why? What's wrong? What is the right way?
This indicates that you've called "Leave" without a corresponding
"Enter". Make sure that for each Leave, you have a corresponding
Enter, and that both calls are made from the same "conditions." Ie,
make sure you don't have code that's like:
if something then
...
MyCS.Enter
End if
..
MyCS.Leave
In this case, if "something" is false, you will get an
IllegalLockException.
HTH,
Jon
==================================================
Hi. Thanks for answer.
My code is like this:
if EnterCritical then
'do somthing
MyCs.Leave
end if
where EnterCritical is
function EnterCritical() as Boolean
MyCs.Enter
return true
end
or
function EnterCritical() as Boolean
return MyCs.TryEnter
end
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>