Sponsored Content
Full Discussion: Timed wait?
Top Forums Programming Timed wait? Post 302124226 by vino on Friday 29th of June 2007 06:46:55 AM
Old 06-29-2007
Please do not duplicate your posts. That is against the rules.

Now on to your post. There is no call in Linux which does something like that. Win32 API's has something on those lines viz WaitForMultipleObjects.

You can try to simulate something like that. After forking the child, the parent can try sleeping for some amount of time.

You may also want to use the WNOHANG flag so that the execution is not suspended if the child's status is not available immediately.

Last edited by vino; 06-29-2007 at 07:54 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Connection Timed out

I connect to a Sun Box through telnet but it timed out in couple of minutes. Advance thanks for any idea...help... (2 Replies)
Discussion started by: s_aamir
2 Replies

2. UNIX for Dummies Questions & Answers

timed commands

Hello, How can I set up events to be executed at a certain time? And do I need some kind of privilege such as being in cron group? (2 Replies)
Discussion started by: rayne
2 Replies

3. 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

4. HP-UX

connection timed out

I am trying to connect with my hp machine using "dialup networking." It times out after 30 seconds. Is there a way to adjust this time. Would it have anything to do with rexec? thanks (0 Replies)
Discussion started by: paschal
0 Replies

5. UNIX for Dummies Questions & Answers

Timed read command

Hi guys, I love unix....but i also hate it :) I want to write a script that will pause in the middle ask for user input, but if no input is given i want the script to continue anyway. Say ask a question and give 1 min to answer and if no answer at all the script continues. (2 Replies)
Discussion started by: Noob e
2 Replies

6. 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

7. Solaris

I/O timed out

I have Ultra 45 Sun solaris box with Solaris 10 installed. My problem is when i boot the unix box, i got the message: What does this message meant? then it does not continue to boot successfully. Please help. Thanks in advance. (5 Replies)
Discussion started by: etcpasswd
5 Replies

8. Shell Programming and Scripting

Timed Scripts

Hi all I need a little bit of help, i am looking for a script that can have different events in it and then if it is a certain day email me about it some sort of email reminder system any ideas thanks (4 Replies)
Discussion started by: ab52
4 Replies

9. Shell Programming and Scripting

timed kill within script?

I want to warn everyone, I am not a programmer lol. I'm an IT wanting to get a little insight of programming, and I like to play around so I can learn. Ok, so I'm going to school for IT Security and Forensics. I had a project to write a hack, and I chose to write a shell script to run dd to write... (8 Replies)
Discussion started by: joshbgosh10592
8 Replies

10. 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
PCNTL_WAIT(3)								 1							     PCNTL_WAIT(3)

pcntl_wait - Waits on or returns the status of a forked child

SYNOPSIS
int pcntl_wait (int &$status, [int $options]) DESCRIPTION
The wait function suspends execution of the current process until a child has exited, or until a signal is delivered whose action is to terminate the current process or to call a signal handling function. If a child has already exited by the time of the call (a so-called "zombie" process), the function returns immediately. Any system resources used by the child are freed. Please see your system's wait(2) man page for specific details as to how wait works on your system. Note This function is equivalent to calling pcntl_waitpid(3) with a -1$pid and no $options. PARAMETERS
o $status -pcntl_wait(3) will store status information in the $status parameter which can be evaluated using the following functions: pcntl_wifexited(3), pcntl_wifstopped(3), pcntl_wifsignaled(3), pcntl_wexitstatus(3), pcntl_wtermsig(3) and pcntl_wstopsig(3). o $options - If wait3 is available on your system (mostly BSD-style systems), you can provide the optional $options parameter. If this param- eter is not provided, wait will be used for the system call. If wait3 is not available, providing a value for $options will have no effect. The value of $options is the value of zero or more of the following two constants OR'ed together: Possible values for $options +----------+---------------------------------------------------+ | | | | WNOHANG | | | | | | | Return immediately if no child has exited. | | | | | | | |WUNTRACED | | | | | | | Return for children which are stopped, and whose | | | status has not been reported. | | | | +----------+---------------------------------------------------+ RETURN VALUES
pcntl_wait(3) returns the process ID of the child which exited, -1 on error or zero if WNOHANG was provided as an option (on wait3-avail- able systems) and no child was available. SEE ALSO
pcntl_fork(3), pcntl_signal(3), pcntl_wifexited(3), pcntl_wifstopped(3), pcntl_wifsignaled(3), pcntl_wexitstatus(3), pcntl_wtermsig(3), pcntl_wstopsig(3), pcntl_waitpid(3). PHP Documentation Group PCNTL_WAIT(3)
All times are GMT -4. The time now is 02:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy