I am writing a program that takes a list of UNIX commands from a file and executes them sequentially every To keep things in order, I must initialize each command and wait for sigwire ()
via SIGUSR1
. When each command gets initialized, then every command can execute.
Usage: & gt; Program.c input.txt
However, it seems that SIGUSR1 is called repeatedly, exceeding sigwait ()
. What's going on here? I have tried many different things, but recently it has been prepared later. To RFRA, I want to see the signal raised for the command immediately after the initialization. I want the signal to be unblocked when all commands start completely
#include 0) {printf ("Run the hair process% d to execute the command% s", getpid (), program); // SIGUSR1 is now blocked and pending - this call will be sent to Sigwit / instant int sig; Favored Results = Sigvite (and Sigset, and SIG); If (result == 0) {printf ("execute child process% d command% s", getpid (), program); Execvp (command [0], command); }}} // has been launched for all programs (i = 0; i
Update: Trying to change sigaction ()
from signal ()
. no changes.
You should consider checking the sigwait after calling to see if the PID There is a hair procedure
then maybe put
int sig;
and
int results = sigwait (& sigset, & amp; sig);
If one checks within the statement that pid == 0 which will indicate that it is a child otherwise you will sign a basic process.
If pid is greater than 0 then this is a basic process ID and if it is less than zero, then there is an error.
Then in each process you will kill the array of your pids (pid_array [i], SIGUSR1) to unblock it.
Comments
Post a Comment