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
EXIT(2) 							System Calls Manual							   EXIT(2)

NAME
_exit - terminate a process SYNOPSIS
_exit(status) int status; DESCRIPTION
_exit terminates a process with the following consequences: All of the descriptors open in the calling process are closed. This may entail delays, for example, waiting for output to drain; a process in this state may not be killed, as it is already dying. If the parent process of the calling process is executing a wait or is interested in the SIGCHLD signal, then it is notified of the calling process's termination and the low-order eight bits of status are made available to it; see wait(2). The parent process ID of all of the calling process's existing child processes are also set to 1. This means that the initialization process (see intro(2)) inherits each of these processes as well. Any stopped children are restarted with a hangup signal (SIGHUP). Most C programs call the library routine exit(3), which performs cleanup actions in the standard I/O library before calling _exit. RETURN VALUE
This call never returns. SEE ALSO
fork(2), sigvec(2), wait(2), exit(3) 4th Berkeley Distribution May 22, 1986 EXIT(2)
All times are GMT -4. The time now is 10:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy