pcox9999
asked on
Threadlist's locklist function hangs my program
When attempting to reset my thread manager by looping through the threadlist object that may have pointers to thread objects, my program hangs. When I set a breakpoint on Threadlist, it comes back as not nil. When I check Locklist it hangs the debugger. At runtime it hangs the program.
if ThreadList.LockList.Count > 0 then begin
Is there a way to check at runtime to avoid this? It is not an error since my try/except handler is never invoked. It seems like the function is waiting indefinitely for the Locklist function to return.
if ThreadList.LockList.Count > 0 then begin
Is there a way to check at runtime to avoid this? It is not an error since my try/except handler is never invoked. It seems like the function is waiting indefinitely for the Locklist function to return.
ASKER
I tried calling UnlockList prior to iterating through the list but it did not change the situation. Maybe I should give you a little context to go along with my question. My threaded list works inside an ActiveForm application used in Internet Explorer 7. I have an htm file that calls the ActiveX form. Works like a charm. Never fails. However when called from an aspx application it fails in the same spot, when calling locklist. I am not sure why there would be a difference. Thoughts?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you.
http://msdn.microsoft.com/en-us/library/ms682608(VS.85).aspx
The pitfalls include:
EXCEPTION_POSSIBLE_DEADLOC
Exceptions that are not intended to be handled
code blocking behavior
(to name a few)
It looks to me like descending a new class from TThreadList would allow you to add a method that would let you wrapper TryEnterCriticalSection so you could get a true or false on whether or not it worked (instead of blocking your code).