Sponsored Content
Full Discussion: wait() function...
Top Forums UNIX for Dummies Questions & Answers wait() function... Post 302459044 by jim mcnamara on Sunday 3rd of October 2010 12:02:16 PM
Old 10-03-2010
No. To wait for all children:
Code:
If the calling process has SA_NOCLDWAIT set or  has  SIGCHLD
set  to  SIG_IGN,  and  the process has no unwaited children
that were transformed into zombie processes, it  will  block
until  all  of  its children terminate, and wait() will fail
and set errno to ECHILD.

Having a NULL argument segfaults. Never tried it personally.
 

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

NAME
wait - wait for a process to exit SYNOPSIS
#include <u.h> #include <libc.h> int wait(Waitmsg *w) DESCRIPTION
Wait causes a process to wait for any child process (see fork(2)) to exit. It returns the pid of a child that has exited and fills in w with more information about the child. W points to a Waitmsg, which has this structure: typedef struct Waitmsg { char pid[12]; /* of loved one */ char time[3*12]; /* of loved one & descendants */ char msg[ERRLEN]; } Waitmsg; Pid is the child's process id. The time array contains the time the child and its descendants spent in user code, the time spent in system calls, and the child's elapsed real time, all in units of milliseconds. All integers in a Waitmsg are formatted as right-justified textual numbers in 11-byte fields followed by a blank. Msg contains the message that the child specified in exits(2). For a normal exit, msg[0] is zero, otherwise msg is prefixed by the process name, a blank, the process id, and a colon. If there are no more children to wait for, wait returns immediately, with return value -1. SOURCE
/sys/src/libc/9syscall SEE ALSO
fork(2), exits(2), the wait file in proc(3) DIAGNOSTICS
Sets errstr. WAIT(2)
All times are GMT -4. The time now is 01:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy