Sponsored Content
Top Forums Programming How to use sigmask in order to make signals can be processed by a thread Post 302502004 by achenle on Sunday 6th of March 2011 12:38:50 PM
Old 03-06-2011
First, never, ever, ever make calls like "printf()" within a signal handler. The only system calls you can safely make from within a signal handler are those listes as async-signal safe. On Linux. see the man page for "signal" for a list.

Calling a non-async-signal-safe call from within a signal handler results in "undefined" behavior. In practice that usually means a deadlock because your signal handler will attempt to acquire a lock already held by the thread that the signal interrupted.

Second, don't call sigfillset() on your sigaction structure. If anything, call sigemptyset().
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Deleting access_log.processed in crontab

Hi, I've worked out that my server was getting clogged with the access_log.processed file. I deleted it using the command > /var/www/vhosts/domain.com/statistics/logs/access_log.processed I also set that up as a crontab job for every Wednesday. What I was wondering is the version using... (4 Replies)
Discussion started by: chickenhouse
4 Replies

2. Shell Programming and Scripting

Awk: first line not processed correctly

Hey, I've made a little awk-script which reorders lines. Works okay, only problem is that is doesn't process the first line correctly. If I switch lines in the Input file it doesn't proces this first line either. Somebody please help! Here's is the code and the input file! thanx ... (1 Reply)
Discussion started by: BartleDuc
1 Replies

3. Programming

Question About Multi-Processed Applications... fork()

Assume we have an application built on *nix that uses fork()...then the processes procedure is going to act as follow: X is considered a parent process (first click on application) Y is considered a child process of X (second click on application) Z is considered a child process of Y (third... (6 Replies)
Discussion started by: f.ben.isaac
6 Replies

4. Programming

How can I make the parent thread wait

Hi All, I will be glad if you could help me resolve this problem. I have created two detachable threads and wanted to them execute independent of the parent thread ( the main task which creates the detachable threads). But I see no output coming from the execution of two detachable threads.... (4 Replies)
Discussion started by: jayfriend
4 Replies

5. Shell Programming and Scripting

Deleting processed lines

I have a log file that I am processing. This contains messages from and to a server (requests and responses). The responses to requests may not be in order i.e. we can have a response to a request after several requests are sent, and in some error cases there may not be any response message. ... (2 Replies)
Discussion started by: BootComp
2 Replies

6. Shell Programming and Scripting

remember processed files

Hello dear community! I have the following task to accomplish: there is a directory with approximately 2 thousand files. I have to write a script which would randomly extract 200 files on the first run. On the second run it should extract again 200 files but that files mustn't intersect with... (5 Replies)
Discussion started by: sidorenko
5 Replies

7. Shell Programming and Scripting

Downloading processed HTML of PHP page

Hi, I am trying to obtain the HTML code of a PHP page (http:// areferee .com/soccer/test1.php?quiz=50&ran=1&t=5) after the page has been processed; I want pure HTML. Is there a Unix command I can use to do this? I have tried wget, GET, curl but I am getting odd behaviour i.e. it is not... (9 Replies)
Discussion started by: djcas
9 Replies

8. Shell Programming and Scripting

Running sed and counting number of lines processed

/bin/sed -n ';4757335,$ p' | wc -l /bin/sed -n ';4757335,$ p' | egrep "Failed" | egrep -c "PM late arrrival" how can i combine the above two sed commands into one? i want to count the number of lines between the specified line number and the end of the file. AND and i want to count how many... (5 Replies)
Discussion started by: SkySmart
5 Replies

9. UNIX for Advanced & Expert Users

Problem With UTF8 Byte Order Make

Hi Im migrating a few websites from my old webserver (CentOS-5) to a new server (CentOS6) , one of these websites is multilingual and has a lot of utf8 files(html,php) with different languages (i.e arabic, persian, russian ,etc). In old server when i do: file mailer.php I get : ... (6 Replies)
Discussion started by: mohs3n
6 Replies

10. Shell Programming and Scripting

Check the file processed Completion

Hi, I have a wierd requirement where i need to check for a file transfered to my Server and once it is completed i need to start processing my jobs. My server is AIX 6.0 and i want to know is there some way in unix i can keep on checking the file and once it is completed successfully i can... (5 Replies)
Discussion started by: prasson_ibm
5 Replies
BSD_SIGNAL(3)						     Linux Programmer's Manual						     BSD_SIGNAL(3)

NAME
bsd_signal - signal handling with BSD semantics SYNOPSIS
#define _XOPEN_SOURCE #include <signal.h> typedef void (*sighandler_t)(int); sighandler_t bsd_signal(int signum, sighandler_t handler); DESCRIPTION
The bsd_signal() function takes the same arguments, and performs the same task, as signal(2). The difference between the two is that bsd_signal() is guaranteed to provide reliable signal semantics, that is: a) the disposition of the signal is not reset to the default when the handler is invoked; b) delivery of further instances of the signal is blocked while the signal handler is executing; and c) if the handler interrupts a blocking system call, then the system call is automatically restarted. A portable application cannot rely on signal(2) to provide these guarantees. RETURN VALUE
The bsd_signal() function returns the previous value of the signal handler, or SIG_ERR on error. ERRORS
As for signal(2). CONFORMING TO
4.2BSD, POSIX.1-2001. POSIX.1-2008 removes the specification of bsd_signal(), recommending the use of sigaction(2) instead. NOTES
Use of bsd_signal() should be avoided; use sigaction(2) instead. On modern Linux systems, bsd_signal() and signal(2) are equivalent. But on older systems, signal(2) provided unreliable signal semantics; see signal(2) for details. The use of sighandler_t is a GNU extension; this type is only defined if the _GNU_SOURCE feature test macro is defined. SEE ALSO
sigaction(2), signal(2), sysv_signal(3), feature_test_macros(7), signal(7) COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. 2009-03-15 BSD_SIGNAL(3)
All times are GMT -4. The time now is 08:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy