Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 11-09-2004, 10:28 AM   #1
LQ Newbie
Registered: Mar 2004
Distribution: United Linux(they forced me to)
Posts: 16

Rep: Reputation: 0
signal handling (SIGSEGV) in threads

Ok, I think I figured out how to recover from a SIGSEGV. I use a signal handler and use setjmp and longump. But how do I do this in a thread safe manner?
I have a section of code, a simple memory accesser, that will sooner or later cause a SIGSEGV by accessing bad memory, and this code is in a class that will be used by a number of threads ( between 5 and 10). What can I do in a multithread enviroment to recover from this fault?
Old 11-09-2004, 05:52 PM   #2
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,681

Rep: Reputation: 218Reputation: 218Reputation: 218
You can block signals on all threads but one and that one will set a marker checked by the threads after risky operations. Not a perfect solution. In most cases you can just write code that does not cause SIGSEGV, however.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Threads in signal handling shilpig Programming 3 08-20-2009 04:14 AM
Kaffeine 0.5 crashes - signal 11 (SIGSEGV) Toonses82 Linux - Software 2 02-02-2005 10:11 AM
k3b crashes with signal 11 sigsegv cf050 Linux - Software 0 11-19-2004 10:39 AM
Signal Handling in Threads[POSIX] anoop_cv Programming 1 11-02-2004 03:00 AM
Signal handling in threads in 2.6 vs. 2.4 kernel dlocke Linux - Software 0 09-29-2004 07:11 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:17 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration