05-06-2011
Quote:
Originally Posted by
sehang
Yes, I may looking at a wrong place... I will try it again now.
But signal = SIGABRT (6), how can I mask this signal within a thread?
As you would do for any other signal in multi-threaded program:
- mask the signal in all thread using pthread_sigblock()
- dedicated a thread that wait synchronously on the signal to occur.
See example from:
SUSv3 - pthread_sigmask()
By the way, SIGABRT is usually caused by abort(). It could be a good idea to check if your program triggers abort() at some places.
HTH, Loïc
10 More Discussions You Might Find Interesting
1. Programming
I have written a program which takes a directory as command line arguments and displays all the dir and files in it.
I don't know why I have a problem with the /etc directory.It displays all the directories and files untill it reaches a sub directory called peers which is in /etc/ppp/peers.the... (4 Replies)
Discussion started by: vijlak
4 Replies
2. Programming
ive written my code in C for implementation of a simple lexical analyser using singly linked list hence am making use of dynamic allocation,but when run in linux it gives a segmentation fault is it cause of the malloc function that ive made use of????any suggestions as to what i could do???
thank... (8 Replies)
Discussion started by: rockgal
8 Replies
3. AIX
Hi ,
During execution a backup binary i get following error
"Program error 11 (Segmentation fault), saving core file in '/usr/datatools"
Riyaz (2 Replies)
Discussion started by: rshaikh
2 Replies
4. Programming
If I do this.
Assume
struct life
{
char *nolife;
}
struct life **life;
// malloc initialization & everything
if(life->nolife == 0)
Would I get error at life->nolife if it is equal to 0.
wrong accession? (3 Replies)
Discussion started by: joey
3 Replies
5. Programming
This code is causing a segmentation fault and I can't figure out why. I'm new to UNIX and I need to learn how to avoid this segmentation fault thing. Thank you so much. Thanks also for the great answers to my last post.:):b:
int main()
{
mysqlpp::Connection conn(false);
if... (3 Replies)
Discussion started by: sepoto
3 Replies
6. Programming
i have this code
int already_there(char *client_names, char *username) {
int i;
for(i = 0; i<NUM; i++) {
printf("HERE\n");
if (strcmp(client_names, username)==0) return(1);
}
return(0);
}
and i get a segmentation fault, whats wrong here? (7 Replies)
Discussion started by: omega666
7 Replies
7. UNIX for Advanced & Expert Users
What does this mean and why is this happening?
$ ps -ef | grep ocular
Segmentation fault (core dumped)
$ ps -ef | grep ocular
Segmentation fault (core dumped)
$ ps aux | grep ocular
Segmentation fault (core dumped)
$ ps
Segmentation fault (core dumped)
$ pkill okular
$ ps... (1 Reply)
Discussion started by: cokedude
1 Replies
8. Programming
I use a binary name (ie polo) it gets some parameter , so for debugging normally i do this :
i wrote script for watchdog my app (polo) and check every second if it's not running then start it , the problem is , if my app , remain in state of segmentation fault for a while (ie 15 ... (6 Replies)
Discussion started by: pooyair
6 Replies
9. Programming
I keep getting this fault on a lot of the codes I write, I'm not exactly sure why so I'd really appreciate it if someone could explain the idea to me.
For example this code
#include <stdio.h>
main()
{
unsigned long a=0;
unsigned long b=0;
int z;
{
printf("Enter two... (2 Replies)
Discussion started by: sizzler786
2 Replies
10. Programming
Oddities with gcc, 2.95.3 for the AMIGA and 4.2.1 for MY current OSX 10.14.1...
I am creating a basic calculator for the AMIGA ADE *NIX emulator in C as it does not have one.
Below are two very condensed snippets of which I have added the results inside the each code section.
IMPORTANT!... (11 Replies)
Discussion started by: wisecracker
11 Replies
LEARN ABOUT HPUX
sigpause
sigpause(3C) sigpause(3C)
NAME
sigpause - signal management
SYNOPSIS
Obsolescent
DESCRIPTION
The function, along with the and functions provide simplified signal management.
The function removes sig from the calling thread's signal mask and suspends the calling thread until a signal is received. The function
restores the thread's signal mask to its original state before returning.
RETURN VALUE
The function suspends execution of the thread until a signal is received, whereupon it shall return and set to
ERRORS
[EINVAL] sig is not a valid signal number.
WARNINGS
The compiler option must be set to use sigpause(). The use of the function without the option is unspecified.
should not be used in conjunction with signal(2) and sigspace(2).
OBSOLESCENT FUNCTION
will be obsoleted in the near future. The obsolescent function blocks signals according to the value of mask, then atomically waits for an
unmasked signal to arrive. On return, restores the current signal mask to the value that existed before the call. When no signals are to
be blocked, a value of is used for mask.
terminates when it is interrupted by a signal. When terminates, it returns -l and sets to
The obsolescent function is typically used in conjunction with the obsoleted function.
Threads Considerations
Since blocked signal masks are maintained at the thread level, the obsolescent function modifies only the calling thread's blocked signal
mask. suspends only the calling thread until it receives a signal.
If other threads in the process do not block the signal, the signal may be delivered to another thread in the process and the thread in may
continue waiting. For this reason, the use of sigwait(2) is recommended instead of for multi-threaded applications.
For more information regarding signals and threads, refer to signal(5).
LP64 Programs
This obsolescent accepts a long (64 bit) value. However, as for ILP32 programs, supports signals numbered 1 through 32. The upper 32 bits
of the mask argument are ignored.
Author
was developed by the University of California, Berkeley.
SEE ALSO
kill(1), kill(2), pause(2), signal(2), wait(2), abort(3C), setjmp(3C), sighold(3C), sigignore(3C), sigrelse(3C), sigset(3C), signal(5).
STANDARDS CONFORMANCE
sigpause(3C)