Sponsored Content
Top Forums Programming Howto spawn multiple child processes and wait? Post 86628 by siegfried on Monday 17th of October 2005 12:21:36 AM
Old 10-17-2005
How to block with signal handling?

How would I block with signal handling? Would I have to poll and then sleep and then poll?

What is the name of the function to call so I can block until receiving a signal?

Thanks,
Siegfried
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

how to make a parent wait on a child shells running in background?

Hi I have a shell script A which calls another 10 shell scripts which run in background. How do i make the parent script wait for the child scripts complete, or in other words, i must be able to do a grep of parent script to find out if the child scripts are still running. My Code: ... (1 Reply)
Discussion started by: albertashish
1 Replies

2. Programming

Program to spawn multiple processes

I'm trying to make a program that will spawn multiple child processes then exit. I'm having trouble figuring out how to do this since after I fork, the child process begins running the program again (never ending). int main(void){ for(int i = 0; i < 3; i++){ fork(); }... (1 Reply)
Discussion started by: cagney58
1 Replies

3. UNIX for Dummies Questions & Answers

Bash: Regulating the number of processes a script can spawn

I've been working on some scripts in which I spawn some background processes. I'd like to be able to limit the number of processes, but have my script spawn additional processes as previous tasks finish. So, let's say I have 20 tasks to complete. Any given task could take from 1 to 10 minutes. ... (7 Replies)
Discussion started by: treesloth
7 Replies

4. Shell Programming and Scripting

Make cron wait for the child process

I am trying to find a list of files and writing it to a text file. Based on the machine performance the file writing will be slow at certain time. The code to find file and redirecting the output to text file is on a shell script /usr/bin/find $SEARCH_DIR -daystart \( \( -name 'KI*' -a... (4 Replies)
Discussion started by: nuthalapati
4 Replies

5. Programming

Parent,child wait,signal

Hello. I want to make a child do some stuff,wait,then the parent does some stuff and then child does some stuff and waits again.I have made the following but it does not work.Can anybody help me? pid1 = fork(); if (pid1 == -1) { perror("Can't create child\n"); ... (18 Replies)
Discussion started by: Cuervo
18 Replies

6. Shell Programming and Scripting

SPAWN Multiple Processes in Unix

Hi, I have three files in my IN directory.Each file should be copied 25 times using for loop.Each file processing should run in parallel?How to spawn multiple processes in unix?Any help would be appreciated. Thanks, Liyakath (7 Replies)
Discussion started by: liyakathali
7 Replies

7. Shell Programming and Scripting

Wait for one processes to complete in a shell script

Let's say I start process A.sh, then start process B.sh. I call both of them in my C.sh How can I make sure that B starts its execution only after A.sh finishes. I have to do this in loop.Execution time of A.sh may vary everytime. It is a parameterized script. (17 Replies)
Discussion started by: rafa_fed2
17 Replies

8. UNIX for Dummies Questions & Answers

How to wait for a grand child to finish?

Hello all, I have a very basic question. I have a requirement where in, I have a main process which forks a child process, which execs and runs a c executable corresponding to a daemon. In the c executable corresponding to a daemon, as everyone does, I fork another child process, and as part of... (7 Replies)
Discussion started by: sai2krishna
7 Replies

9. Shell Programming and Scripting

How make parent to wait from child process?

Hi all, I am starting mgen5 for sometime depends on input from a file, in a child process. now I want to make parent to wait in this child process till mgen5 finishes, or timeout happens. could anyone please tell me how to make parent to wait in child process in shell script? thanks... (2 Replies)
Discussion started by: girijajoshi
2 Replies

10. UNIX for Beginners Questions & Answers

Wait till any one child process finishes

Hi I am facing a problem in my ksh. My main script is calling 3 different child process in the background. I am using wait to finish all and then submit another 3 child processes. Now what i want is , whenever any one child process finishes ,i want to submit next one.so that parallel 3... (2 Replies)
Discussion started by: Sangu
2 Replies
explain_poll_or_die(3)					     Library Functions Manual					    explain_poll_or_die(3)

NAME
explain_poll_or_die - wait for some event on file descriptor and report errors SYNOPSIS
#include <libexplain/poll.h> int explain_poll_or_die(struct pollfd *fds, int nfds, int timeout); int explain_poll_on_error(struct pollfd *fds, int nfds, int timeout); DESCRIPTION
The explain_poll_or_die function is used to call the poll(2) system call. On failure an explanation will be printed to stderr, obtained from the explain_poll(3) function, and then the process terminates by calling exit(EXIT_FAILURE). The explain_poll_on_error function is used to call the poll(2) system call. On failure an explanation will be printed to stderr, obtained from the explain_poll(3) function, but still returns to the caller. fds The fds, exactly as to be passed to the poll(2) system call. nfds The nfds, exactly as to be passed to the poll(2) system call. timeout The timeout, exactly as to be passed to the poll(2) system call. RETURN VALUE
The explain_poll_or_die function only returns on success, see poll(2) for more information. On failure, prints an explanation and exits, it does not return. The explain_poll_on_error function always returns the value return by the wrapped poll(2) system call. EXAMPLE
The explain_poll_or_die function is intended to be used in a fashion similar to the following example: int result = explain_poll_or_die(fds, nfds, timeout); SEE ALSO
poll(2) wait for some event on a file descriptor explain_poll(3) explain poll(2) errors exit(2) terminate the calling process COPYRIGHT
libexplain version 0.52 Copyright (C) 2010 Peter Miller explain_poll_or_die(3)
All times are GMT -4. The time now is 03:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy