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: David Mosberger
Subject: RE: [libunwind] Signal handlers and unw_resume
Date: Tue, 24 Aug 2004 03:40:52 -0700

>>>>> On Tue, 24 Aug 2004 10:30:07 +0100, "Thomas Hallgren" <address@hidden> 
>>>>> said:

  Thomas> My original question on this topic was if it's safe to do an
  Thomas> unw_resume from within a signal handler after a series of
  Thomas> unw_step calls. My concern was that it would bypass any
  Thomas> clean up routines that the OS would normally perform when
  Thomas> the signal routine returns.

If by "OS" you mean "kernel", then there is no issue: the unw_resume()
will be sufficient.  My comments were about cleanup handlers that may
be present between the signal-frame and the frame that does the
unw_resume().  If you know that there are no cleanup-handlers, there
is no issue.

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

That's fine if you don't have cleanup handlers in the signal-handler
frame(s).

        --david


reply via email to

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