Sponsored Content
Full Discussion: wait() function...
Top Forums UNIX for Dummies Questions & Answers wait() function... Post 302459039 by joker40 on Sunday 3rd of October 2010 11:32:10 AM
Old 10-03-2010
wait() function...

when wait() is called by process it blocks calling process until child is done. What happens if calling process have multiple children.
What does wait(NULL) function do. Waits until all children are done?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to execute 2 scripts, wait, execute 2 more wait, till end of file

:cool: I need to execute a shell script to do the following: cat a file run two back ground processes using the first two values from the file wait till those background processes finish run two more background processes using the next two values from the file wait till those background... (1 Reply)
Discussion started by: halo98
1 Replies

2. UNIX for Dummies Questions & Answers

About wait

Hi everyone I'm novice at Unix programming and I hope to post this thread in the correct place. I have the following doubts: 1 Suppose we have some processes which are B's children process and another process A which has no relation with B and its children. Can A do wait () for a... (5 Replies)
Discussion started by: Puntino
5 Replies

3. Shell Programming and Scripting

wait command - cat it wait for not-chile process?

Did not use 'wait' yet. How I understand by now the wait works only for child processes, started background. Is there any other way to watch completion of any, not related process (at least, a process, owned by the same user?) I need to start a background process, witch will be waiting... (2 Replies)
Discussion started by: alex_5161
2 Replies

4. Shell Programming and Scripting

Passing global variable to a function which is called by another function

Hi , I have three funcions f1, f2 and f3 . f1 calls f2 and f2 calls f3 . I have a global variable "period" which i want to pass to f3 . Can i pass the variable directly in the definition of f3 ? Pls help . sars (4 Replies)
Discussion started by: sars
4 Replies

5. Shell Programming and Scripting

race condition with wait() function

Hi, I'm currently writing a bash script, that starts multiple threads: ____________________ #!/bin/bash loop=0 while((loop!=10)) do thread & ((loop++)) done #wait for all sub-processes (thread) to finish wait ___________________ Now I want to know, what happens, if a... (2 Replies)
Discussion started by: tho99
2 Replies

6. Shell Programming and Scripting

Wait function in a script

Hi everyone, I need some help to create a script. This script have to create a file once all the process inside are finish. Here how I want to do : #!/bin/ksh /home/oracle/save1.ksh & proc_id1=$! /home/oracle/save2.ksh & proc_id2=$! /home/oracle/save3.ksh & proc_id3=$! ... (4 Replies)
Discussion started by: remfleyf
4 Replies

7. Shell Programming and Scripting

wait example

Hi Gurus, Some questions regarding wait. I have tried searching in this forum for threads on wait but not completely got what I am looking for. Background: One script (.sh) that starts/calls a reference to an application's executable and submits a batch job to it. Objective is to wait... (2 Replies)
Discussion started by: rsheikh
2 Replies

8. Shell Programming and Scripting

calling a shell script in background and wait using "wait" in while loop

Hi, I am facing a strange issue, when i call a script from my while loop in background it doesnt go in background, despite the wait i put below the whil loop it goes forward even before the process put in background is completed. cat abc.txt | while read -u4 line do #if line contains #... (2 Replies)
Discussion started by: mihirvora16
2 Replies

9. Shell Programming and Scripting

Will files, creaetd in one function of the same script will be recognized in another function?

Dear All. I have a script, which process files one by one. In the script I have two functions. one sftp files to different server the other from existing file create file with different name. My question is: Will sftp function recognize files names , which are created in another... (1 Reply)
Discussion started by: digioleg54
1 Replies

10. Shell Programming and Scripting

Function - Make your function return an exit status

Hi All, Good Day, seeking for your assistance on how to not perform my 2nd, 3rd,4th etc.. function if my 1st function is in else condition. #Body function1() { if then echo "exist" else echo "not exist" } #if not exist in function1 my all other function will not proceed.... (4 Replies)
Discussion started by: meister29
4 Replies
wait(3) 						     Library Functions Manual							   wait(3)

NAME
wait - check child process status SYNTAX
#include <wait.h> int wait_nohang(&wstat); int wait_stop(&wstat); int wait_stopnohang(&wstat); int wait_pid(&wstat,pid); int wait_exitcode(wstat); int wait_crashed(wstat); int wait_stopped(wstat); int wait_stopsig(wstat); int pid; int wstat; DESCRIPTION
wait_nohang looks for zombies (child processes that have exited). If it sees a zombie, it eliminates the zombie, puts the zombie's exit status into wstat, and returns the zombie's process ID. If there are several zombies, wait_nohang picks one. If there are children but no zombies, wait_nohang returns 0. If there are no children, wait_nohang returns -1, setting errno appropriately. wait_stopnohang is similar to wait_nohang, but it also looks for children that have stopped. wait_stop is similar to wait_stopnohang, but if there are children it will pause waiting for one of them to stop or exit. wait_pid waits for child process pid to exit. It eliminates any zombie that shows up in the meantime, discarding the exit status. wait_stop and wait_pid retry upon error_intr. STATUS PARSING
If the child stopped, wait_stopped is nonzero; wait_stopsig is the signal that caused the child to stop. If the child exited by crashing, wait_stopped is zero; wait_crashed is nonzero. If the child exited normally, wait_stopped is zero; wait_crashed is zero; and wait_exitcode is the child's exit code. SEE ALSO
wait(2), error(3) wait(3)
All times are GMT -4. The time now is 01:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy