This is the mail archive of the libc-alpha@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Help: Unwinding the C++ stack...throw, longjmp & threads



Hi,

On Wed, 18 Aug 1999, George T. Talbot wrote:

> This is a request for assistance, as I don't know the right person to
> ask.
> 
> I'm working on a solution for deferred pthread_cancel() under Linux. 
> What I want is to unwind the stack when the thread is cancelled so that
> C++ destructors for objects on the stack get called.
> 
> If I recompile the C library with the -fexceptions flag, I can throw an
> exception in a cancellation handler, and this does what I want.  My
> platform is Linux x86.
> 
> However, after talking to Ulrich Drepper at LWCE, he says that
> recompiling the C library with -fexceptions slows it down by around 5%. 
> So, obviously, he won't accept a patch to the main-line source to do
> this, with very good reason.

just curious, what exactly was measured and how?

any details?

> I would like to write a function which unwinds the stack similarly to
> what happens at a throw in C++, but which wouldn't require recompiling
> existing libraries written in C.
> 
> Is this possible?  Can anyone point me to the source for how throw
> unwinds the stack?  I've been looking at the egcs 1.1.2 source tree, but
> there's a lot to look at, and I'm confused with the different models for
> throw and catch.  Alternatively, could someone put me in touch with the
> folks that work on C++ exceptions in gcc on the x86 processor?
> 
> Also, does setjmp()/longjmp() assure that C++ destructors for
> stack-based objects are called?
> 
> Sorry if some/all of these questions are dumb.  Thanks.
> 
> --
> George T. Talbot
> <george@moberg.com>

OK


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]