11-12-2009
Instead of an infinite loop, for(n=0; n<50; n++)
Or do you mean these processes need to be continually replaced when they quit?
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I don't follow what these are...
this is what my text says...
"When a process is started, a duplicate of that process is created. This new process is called the child and the process that created it is called the parent. The child process then replaces the copy for the code the parent... (1 Reply)
Discussion started by: xyyz
1 Replies
2. Programming
Hello all, I am trying to create n child processes and control them from a parent process; say make child 3 print its pid and then child 5 do the same and some other stuff. Is there a way to accomplishing this after all the child processes are created via a call to fork().
Thank you,
FG (23 Replies)
Discussion started by: forumGuy
23 Replies
3. Shell Programming and Scripting
Hello.
I have a global function name func1() that I am sourcing in from script A. I call the function from script B. Is there a way to find out which script called func1() dynamically so that the func1() can report it in the event there are errors?
Thanks (2 Replies)
Discussion started by: yoi2hot4ya
2 Replies
4. Programming
Hello,
How many child processes are actually created when running this code ?
#include <signal.h>
#include <stdio.h>
int main () {
int i ;
setpgrp () ;
for (i = 0; i < 10; i++) {
if (fork () == 0) {
if ( i & 1 ) setpgrp () ;
printf ("Child id: %2d, group: %2d\n", getpid(),... (0 Replies)
Discussion started by: green_dot
0 Replies
5. Shell Programming and Scripting
Hello,
How many child processes are actually created when running this code ?
#include <signal.h>
#include <stdio.h>
int main () {
int i ;
setpgrp () ;
for (i = 0; i < 10; i++) {
if (fork () == 0) {
if ( i & 1 ) setpgrp () ;
printf ("Child id: %2d, group: %2d\n",... (1 Reply)
Discussion started by: green_dot
1 Replies
6. UNIX for Advanced & Expert Users
Hi,
Is there a way I can kill all the child processes of a process, given its process id.
Many thanks in advance.
J. (1 Reply)
Discussion started by: superuser84
1 Replies
7. Shell Programming and Scripting
I have a parent process which will start 36 child process. This I achieved by using the 'for loop'.
In Parent.sh:-
./Child.sh <arg1> <arg2> ... &
If I execute "ps -ef | grep Child.sh", I can see 72 child processes running at the background. I mean I can see the duplicate of each process.
... (2 Replies)
Discussion started by: nthiruvenkatam
2 Replies
8. Shell Programming and Scripting
Hi,
I have parent script which is invoking multiple child scripts. I would want to kill all the child processes before the parent
process exit.
> cat ./parent
#!/bin/ksh
while
do
. ./child arg1 &
if ; then
break
fi
done
Is there a way to get the process group id for all the child... (3 Replies)
Discussion started by: midhun19
3 Replies
9. Shell Programming and Scripting
I am trying to implement the below using Ksh script on a Lx machine.
There is a file(input_file) with 100K records. For each of these records, certain script(process_rec) needs to be called with the record as input. Sequential processing is time-consuming and parallel processing would eat up... (2 Replies)
Discussion started by: APT_3009
2 Replies
10. Shell Programming and Scripting
is there a universal way of getting the children of a particular process? i'm looking for a solution that works across different OSes...linux, aix, sunos, hpux.
i did a search online and i kept finding answers that were specific to Linux..i.e. pstree.
i want to be able to specify a process... (2 Replies)
Discussion started by: SkySmart
2 Replies
LEARN ABOUT HPUX
xtappmainloop
XtAppMainLoop() XtAppMainLoop()
Name
XtAppMainLoop - continuously process events.
Synopsis
void XtAppMainLoop(app_context)
XtAppContext app_context;
Inputs
app_context
Specifies the application context that identifies the application.
Returns
XtAppMainLoop() enters an infinite loop and never returns.
Description
XtAppMainLoop() enters an infinite loop which calls XtAppNextEvent() to wait for an events on all displays in app_context and XtDis-
patchEvent() to dispatch that event to the appropriate code.
Usage
Most applications will call XtAppNextEvent() as the last line of their main() procedure. Some applications may provide their own versions
of this loop, however. A custom event loop might test an application-dependent global flag or other termination condition before looping
back and calling XtAppNextEvent(). If the number of top-level widgets drops to zero, the application may be able to exit safely, for exam-
ple.
Applications that use multiple application contexts or that use internal event loops will have to build their own event loop.
Background
XtAppNextEvent() looks for X events in the input queue, and also handles timer events (see XtAppAddTimeOut()) and events from alternate
input sources (see XtAppAddInput()). If none of these events are pending and a work procedure (see XtAppAddWorkProc()) is registered,
XtAppNextEvent() invokes that work procedure to do background processing, otherwise it blocks waiting for an event. Note that XtAppNex-
tEvent() dispatches timer and input events directly, but returns any X events that occur. Within XtAppMainLoop(), these X events are
always passed to XtDispatchEvent().
XtDispatchEvent() dispatches an event to the appropriate event handlers (see XtAddEventHandler()). Note that the translation manager reg-
isters an event handler, and that events that are dispatched to the translation manager will be further dispatched through the transla-
tions-to-actions mechanism.
Example
XtAppMainLoop() is implemented as follows:
void XtAppMainLoop(app)
XtAppContext app;
{
XEvent event;
for (;;) {
XtAppNextEvent(app, &event);
XtDispatchEvent(&event);
}
}
See Also
XtAddEventHandler(1), XtAppAddInput(1), XtAppAddTimeOut(1), XtAppAddWorkProc(1), XtAppNextEvent(1), XtAppProcessEvent(1), XtDis-
patchEvent(1).
Xt - Event Handling XtAppMainLoop()