473,385 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

signal handlers: does %SIG{'CLD'} require explicit SA_NOCLDSTOP via POSIX funcs?


Hi,

I'm writing a server process which spawns child processes via fork
This server process should keep track of the number of children stil
running, do the necessary cleanup to avoid zombies, etc.

In the beginning I thought I had to use the POSIX module, using SigSet
SigAction, sigprocmask etc. for a rather paranoid approach.

Then I've rea
('http://cis.uniroma2.it/guides/perl/pod/perlipc/deferred_signals__safe_signals_.html
(http://)) that as of perl 5.7.3, perl is safe(r) concerning signa
handling, and I wonder if I can safely go back to using the (mor
convenient) %SIG hash and leaving the rest up to perl.

My major concern is to keep track of the child processes (maintain PID
of living children in a hash, wait for dead children, remove their PID
from the hash). Which I probably could conveniently do with a signa
handler for the SIGCHLD (or is it SIGCLD?) signal.

Two concerns:

I would like to make sure to defer any further signal handling whil
the signal handler itself is active.

And I would like to make sure that child processes do NOT send
SIGCHLD on stop, which I think can be set via something like
Code
-------------------
POSIX::SigAction->new( 'main::catch_sigchld', $sigset_chld, &POSIX::SA_NOCLDSTOP
-------------------
Now my question:

Do the later perl versions automatically defer signals during the tim
the signal handler is executed; and is SA_NOCLDSTOP used by default s
that the handler only gets called if the child is dead, not if i
stops?

In other words, can I rely upon %SIG to install my handlers, or shoul
I use the POSIX module objects/functions?

Thanks,
Steffe
-
steffen staehl
-----------------------------------------------------------------------
Posted via http://www.codecomments.co
-----------------------------------------------------------------------

Jul 19 '05 #1
0 3327

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: angel | last post by:
A java runtime environment includes jvm and java class (for example classes.zip in sun jre). Of course jython need jvm,but does it need java class. Thanx
0
by: steffen staehle | last post by:
Hi, I'm writing a server process which spawns child processes via fork This server process should keep track of the number of children stil running, do the necessary cleanup to avoid zombies,...
6
by: Vyacheslav Lanovets | last post by:
Hello, All! I know that Explicit Instantiation actually emits code to obj files (so you can even export them from the module as plain functions or classes). But I found that MSVC7.1 compiler...
10
by: Martin Zenkel | last post by:
Assumed two assemblies (one C# and one C++), C++ refers to C#. The follwing code compiles and works well under VS 2002! VS 2003 C++ compiler reports the error "error 2555:...
11
by: Philip Wagenaar | last post by:
Hello, I am using a timer object in my Windows Forms Application. Does the code in ..elapsed event run in a diffrent thread? If the interval is set to 10 milliseconds and the time to execute the...
7
by: Matthew Crouch | last post by:
I'm building a site hosted on Yahoo, and apparently they've got it set so that nothing -- not even fatal errors -- are displayed. I also have an extremely complicated line of code:...
2
by: nephish | last post by:
hey there, ok, i am starting with building my Customer custom php class. now, one funciton that i want to write will populate the class variables with values from the database. i have a function...
89
by: Cuthbert | last post by:
After compiling the source code with gcc v.4.1.1, I got a warning message: "/tmp/ccixzSIL.o: In function 'main';ex.c: (.text+0x9a): warning: the 'gets' function is dangerous and should not be...
38
by: JTL | last post by:
I have learnt java before and now begin to learn c++ what puzzle me is that seem that different SDKs(c++builder, vs.net, gcc..) has its own class library we know that in java there are only one...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.