LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 11-09-2004, 09:28 AM   #1
Sinner6
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, 04:52 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
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.
 
  


Reply



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 03:14 AM
Kaffeine 0.5 crashes - signal 11 (SIGSEGV) Toonses82 Linux - Software 2 02-02-2005 09:11 AM
k3b crashes with signal 11 sigsegv cf050 Linux - Software 0 11-19-2004 09:39 AM
Signal Handling in Threads[POSIX] anoop_cv Programming 1 11-02-2004 02:00 AM
Signal handling in threads in 2.6 vs. 2.4 kernel dlocke Linux - Software 0 09-29-2004 06:11 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:32 PM.

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