Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6532513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:00:45+00:00 2026-05-25T10:00:45+00:00

I have an application which starts multiple threads. I am using a signal handler

  • 0

I have an application which starts multiple threads.
I am using a signal handler to catch the signals.

I don’t want my application to quit on SIGSEGV; I want to terminate only the thread that incurred the signal, and to continue the flow of the full application in the other threads.
Is it possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T10:00:46+00:00Added an answer on May 25, 2026 at 10:00 am

    If a SIGSEGV happens, it indicates that your program has already invoked undefined behavior, i.e. the state of the entire program is undefined/indeterminate/invalid. In practice it’s possible that you may be able to recover and keep running, but there’s no guarantee, and it could be dangerous.

    As asveikau mentioned, you could longjmp out of the signal handler and try to clean up, but this could make an even worse mess if the crash happened in the middle of malloc, free, printf, or any function modifying the state of global data or data that’s shared with other threads or that will be accessed in the cleanup code at the longjmp destination. The state may be corrupt/inconsistent, and/or locks may be held and left permanently unreleasable.

    If you can ensure this won’t happen – for example if the misbehaving thread never calls any async-signal-unsafe functions – then it may be safe to longjmp out of the signal handler then call pthread_exit.

    An alternative might be to permanently freeze the thread in the signal handler, by adding all signals to the sa_mask for SIGSEGV and then writing for (;;) pause(); in the signal handler. This is 100% “safe”, but may leave the process in a deadlocked state if any locks were held by the crashing thread. This is perhaps “less bad” than exposing corrupt state to other threads and further clobbering your data to hell…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an existing iPhone application which starts from a UIViewController. What I want
I have a web application, written in ColdFusion, which periodically starts using 100% of
I have a batch file which starts multiple instances of simple console application (Hello
I have a small image processing application which does multiple things at once using
I have an application which extracts data from an XML file using XPath. If
I have an application which I am developing using WPF\Prism\MVVM. All is going well
I have an application which needs to connect to multiple databases. This is an
I have a Generic HTTP Handler (*.ashx) in my ASP.Net application which performs some
We have a WinForms desktop application, which is heavily multithreaded. 3 threads run with
I have developed one application which used to send/receive mails using Exchange Server 2003

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.