Sponsored Content
Top Forums Programming how to discard instruction from previous signal Post 302341899 by matrixmadhan on Friday 7th of August 2009 12:10:38 AM
Old 08-07-2009
Quote:
Originally Posted by Corona688
Well, you can't cancel signals that way. How about blocking them instead? You can make a signal wait in a queue until you're ready to deal with it with sigprocmask.
I see a potential problem (rare) with this approach, what if, when a file is being processed, signal 2 (2nd instance) is passed, since its blocked it will have to wait, while the first file is still being processed and if there are multiple instances of signals being queued ( due to the reason they are blocked ) ... that could be when there is an application bug that is indefinitely processing a file, without completing the signal handler, or closing a filehandle via possible stale NFS.

All these will have end up in having multiple signals in state " that are yet to be delivered "

---------- Post updated at 09:40 AM ---------- Previous update was at 09:34 AM ----------

Quote:
Originally Posted by nvhoang
Thank you all Corona688 and matrixmadhan for your replies,

Because I have 2 applications and need to make communication via files and signal.
The first application shall write some files then send a signal to the second application telling the second to processes and then delete those files.

The problem is that, when the second is processing those files, the first one may throw new files and signal (the goal is the second gets latest data); therefore the second might delete new files which leads to lost of data or to be consistent.

So I hope that, I could, when a signal comes the second restarts processing those files (and discard instructions from previous signal action). I know this is not nature of signal handling.

(I know that I can make it synchronously by making the second send back a signal to the first to tell that it is ready to receive new signal, for example).
Correct me if am wrong somewhere, please

these are the sequence of actions
  1. first application processing is processing a file
  2. processing done, first application sends a signal to second appln to initiate processing
  3. second application starts processing
  4. before 2nd could complete, first completes processing and makes 2nd file ready for processing, signals 2nd application.

Now, should 2nd application delete the first file and start processing the second file?

If that is the case, there could be a shared memory segment between 1st and 2nd application and make 2nd application to listen for any data contents in the shared memory segment, and based on the filename in the data segment process only that file and discard others.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Case Instruction

Hi, this is my script to make a choice between 4 : clear echo " choose a profile and enter a number" echo echo " 1- oraSTT " echo echo " 2- appSTT " echo... (3 Replies)
Discussion started by: big123456
3 Replies

2. Solaris

what is that 1 in the instruction!~ (please help fast)

Hi all, make_lofs /.cdrom/<something>/<something> 1 what does this instruction mean? Note:both the "something" are obviously different . I would like to know what that 1 means, the rest of the instruction is clear!! Thanks (6 Replies)
Discussion started by: wrapster
6 Replies

3. Shell Programming and Scripting

sed discard chars after last _

Hi, I'd get fields like unix_linux_form_yyyyddmmhhmi.file.txt shell_programming_and_scripting.txt so on... and want them as below unix_linux_form shell_programming_and I could remove everything after a '.' as below echo $field | sed 's/\..*//' but how to remove... (14 Replies)
Discussion started by: dips_ag
14 Replies

4. Shell Programming and Scripting

ksh interrupt read instruction with signal

Dear shell experts, I spent last few days porting ksh script from ksh88/SunOS to ksh93/Linux. Basically, things are going well and I do not have too much troubles porting ks88 script to ksh93, but I stuck on one item. It's about sending and handling the signal. I found two similar... (8 Replies)
Discussion started by: bzk
8 Replies

5. Shell Programming and Scripting

how to find pattern and discard lines before it?

Hi all, I'd like to search a file for the first occurence of the phrase "PLASTICS THAT EXPIRE" and then discard all the lines that came before it. Output the remainder to a new file. Operating system is hp-ux. I've searched for usual awk and sed one liners but can't find a solution. Thank... (4 Replies)
Discussion started by: Scottie1954
4 Replies

6. Shell Programming and Scripting

Remove previous line if next & previous lines have same 4th character.

I want to remove commands having no output. In below text file. bash-3.2$ cat abc_do_it.txt grpg10so>show trunk group all status grpg11so>show trunk group all status grpg12so>show trunk group all status GCPKNYAIGT73IMO 1440 1345 0 0 94 0 0 INSERVICE 93% 0%... (4 Replies)
Discussion started by: Raza Ali
4 Replies

7. Shell Programming and Scripting

Cp –r instruction

Pleas I want answer to this question? Pleas help me A system administrator suspects that there is an attack on his machine; he needs to make a backup of the files to check when they have been modified. For this purpose he uses the "cp -r" instruction to copy the root directory. What is the... (1 Reply)
Discussion started by: tamer11007
1 Replies

8. Shell Programming and Scripting

Number some lines discard others?

Hi, I'd like to do an operation on text with a format like this this line shall be numbered this line shall not be numbered this line shall also be numbered this line shall not not be numbered And I want an output like this 1 this line shall be numbered this line... (6 Replies)
Discussion started by: jeppe83
6 Replies

9. Shell Programming and Scripting

Discard part of a file based on a pattern ---

I have the file: s3_T0(2) Pos "1" "2" s1_T1(2) Pos "1" "2" --- 0 0 1 0 0 1 1 1 --- 1 2 "tau0" 1 2 "h10" I want to patternmatch on --- and get only the third part i.e. 1 2 "tau0" 1 2 "h10" I wanted to start simple but even something like (5 Replies)
Discussion started by: eagle_fly
5 Replies

10. UNIX for Dummies Questions & Answers

Crunch character combination and discard similar content

Hi guys ! I generated the power set of the set S={a,b,c} using crunch: crunch 1 3 abc and get the 39 possible subsets: a b c aa ab ac ba bb bc ca cb cc … (2 Replies)
Discussion started by: beca123456
2 Replies
abort(3C)						   Standard C Library Functions 						 abort(3C)

NAME
abort - terminate the process abnormally SYNOPSIS
#include <stdlib.h> void abort(void); DESCRIPTION
The abort() function causes abnormal process termination to occur, unless the signal SIGABRT is being caught and the signal handler does not return. The abnormal termination processing includes at least the effect of fclose(3C) on all open streams and message catalogue descriptors, and the default actions defined for SIGABRT. The SIGABRT signal is sent to the calling process as if by means of the raise(3C) function with the argument SIGABRT. The status made available to wait(3C) or waitpid(3C) by abort will be that of a process terminated by the SIGABRT signal. abort will override blocking or ignoring the SIGABRT signal. RETURN VALUES
The abort() function does not return. ERRORS
No errors are defined. USAGE
Catching the signal is intended to provide the application writer with a portable means to abort processing, free from possible interfer- ence from any implementation-provided library functions. If SIGABRT is neither caught nor ignored, and the current directory is writable, a core dump may be produced. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |Safe | +-----------------------------+-----------------------------+ SEE ALSO
exit(2), getrlimit(2), kill(2), fclose(3C), raise(3C), signal(3C), wait(3C), waitpid(3C), attributes(5), standards(5) SunOS 5.11 24 Jul 2002 abort(3C)
All times are GMT -4. The time now is 10:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy