madExcept and threads pool

delphi package - automated exception handling
Post Reply
DmitryS
Posts: 5
Joined: Tue Nov 29, 2005 5:12 am

madExcept and threads pool

Post by DmitryS »

madExcept can't catch exception rasing in thread from threads pool in Windows XP (QueueUserWorkItem)
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

You can work around that by adding this around your thread code:
try
.. // real code here
except madExcept.HandleException end;
Do you happen to have a little test project lying around for me? Or could you eventually create one? I've never worked with QueueUserWorkItem yet!

Thanks!
DmitryS
Posts: 5
Joined: Tue Nov 29, 2005 5:12 am

Post by DmitryS »

I send test project for bcb6
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Thanks for the test program. I've added a special hook for
QueueUserWorkItem, which will be contained in the next
build.
DmitryS
Posts: 5
Joined: Tue Nov 29, 2005 5:12 am

Post by DmitryS »

Thanks for good job (madExcept 3.0a).
Except QueueUserWorkItem, with threads pool work next function:

BindIoCompletionCallback
CreateTimerQueue
CreateTimerQueueTimer
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Ouch... :)
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Here's a new beta build which hooks into QueueUserWorkItem:

http://madshi.net/madCollectionBeta.exe

It doesn't yet hook into the other APIs you mentioned, though.
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

I've had a quick look at the other APIs, but I didn't manage to hook them on a quick try. You'll have to frame your timer and io completion callbacks with a try..catch call. In the catch block call "madExcept.HandleException".
Post Reply