libunwind-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [libunwind] Signal handlers and unw_resume


From: Thomas Hallgren
Subject: RE: [libunwind] Signal handlers and unw_resume
Date: Tue, 24 Aug 2004 10:30:07 +0100

> I guess I'm missing the point of this.  How would this be any
> different from simply doing an unw_resume() from the signal-handler?
> 
My original question on this topic was if it's safe to do an unw_resume
from within a signal handler after a series of unw_step calls. My
concern was that it would bypass any clean up routines that the OS would
normally perform when the signal routine returns.

Let me describe what I'm trying to accomplish, top down.

I have an optimizer thread that interrupts other threads to investigate
what they do and sometimes perform hotspot optimizations. Such an
optimization implies patching code that is currently executing. Such a
patch cannot be performed unless all threads can be brought to a "safe"
position. Bringing threads to a safe position implies roll forwarding.

I want the signal handler to obtain the context for its thread and then
bring the cursor to the place where the interruption occurred (hence the
unw_getcontext, unw_init_local, and unw_step to just below the signal
frame). After that, the signal handler will hand of the cursor to the
optimizer thread and go to sleep. The optimizer thread will to do
roll-forwarding to a safe position, perform its optimizations, and
finally let the interrupted thread resume execution. The interrupted
thread now calls unw_resume instead of returning from the signal
handler.

Another scenario is our exception handling where the signal originates
from the "try" section and the thread must resume in the "catch" or
"finally" section.

Regards,

Thomas Hallgren




reply via email to

[Prev in Thread] Current Thread [Next in Thread]