C++ Exceptions and multithreading 
Author Message
 C++ Exceptions and multithreading

Hi,

I've had some trouble using C++ exceptions from multiple threads.

The program normally deadlocks inside NTDLL just after cxxThrowException
when i have around 50 threads that all try to throw an exception at the same
time.

I've searched around MSDN for any details on locks ThrowException aquires,
but can't find anything :/

Anyone got any ideas?

--
-
Thong Nguyen
http://www.*-*-*.com/



Tue, 18 Feb 2003 15:54:04 GMT  
 C++ Exceptions and multithreading
Do you have the same behaviour in both debug and release builds? I've seen
cases where my code hangs in RaiseException(), but only in debug builds (but
maybe I'm just a lucky guy).

I can't really see any reasons for locking when raising an exception as
exception information are stored on a thread basis. Maybe it would be better
if you posted this question to microsoft.public.win32.kernel instead, the
guys there should have better insight on this issue.

// Johan


Quote:
> Hi,

> I've had some trouble using C++ exceptions from multiple threads.

> The program normally deadlocks inside NTDLL just after cxxThrowException
> when i have around 50 threads that all try to throw an exception at the
same
> time.

> I've searched around MSDN for any details on locks ThrowException aquires,
> but can't find anything :/

> Anyone got any ideas?

> --
> -
> Thong Nguyen
> http://tummy.veridicus.com



Tue, 18 Feb 2003 16:18:05 GMT  
 C++ Exceptions and multithreading

Thanks for the reply.

The same thing happens when in release mode. I might repost to the kernel
newsgroup.

I too don't see why they should hang, cause exceptions are isolated in their
own respective threads (and the that threads' stack).  I'm thinking perhaps
throw locks some CRT section that we don't know about.

--
-
Thong Nguyen
http://tummy.veridicus.com


Quote:
> Do you have the same behaviour in both debug and release builds? I've seen
> cases where my code hangs in RaiseException(), but only in debug builds
(but
> maybe I'm just a lucky guy).

> I can't really see any reasons for locking when raising an exception as
> exception information are stored on a thread basis. Maybe it would be
better
> if you posted this question to microsoft.public.win32.kernel instead, the
> guys there should have better insight on this issue.

> // Johan



> > Hi,

> > I've had some trouble using C++ exceptions from multiple threads.

> > The program normally deadlocks inside NTDLL just after cxxThrowException
> > when i have around 50 threads that all try to throw an exception at the
> same
> > time.

> > I've searched around MSDN for any details on locks ThrowException
aquires,
> > but can't find anything :/

> > Anyone got any ideas?

> > --
> > -
> > Thong Nguyen
> > http://tummy.veridicus.com



Tue, 18 Feb 2003 16:30:29 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. C++ Exceptions and multithreading

2. Multithreading exception problem

3. Translate a SEH exception into a C++ exception

4. Catching hardware exceptions using C++ exceptions

5. Catching SEC Exceptions as C++ Exceptions

6. Win32 structured exceptions vs C++ exceptions

7. retrieve exception context in C++ exception handler

8. Exceptions : Combining C++ and Structured Exception Handling ?

9. managed C++ wrapper around unmanaged C++ classes: causing StackOverflow exception

10. Does Managed C++ forces multithreading?

11. Need a good tutorial on multithreading in Visual C++ 6.0

12. Multithreading and Standard C++ Library

 

 
Powered by phpBB® Forum Software