delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/08/30/12:42:13

From: sbiswas AT novell DOT com (Soumen Biswas)
Subject: fork - Is there a problem:
30 Aug 1997 12:42:13 -0700 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <s402847c.060.cygnus.gnu-win32@novell.com>
Mime-Version: 1.0
X-Mailer: Novell GroupWise 4.1
Original-To: gnu-win32 AT cygnus DOT com
Original-Sender: owner-gnu-win32 AT cygnus DOT com

Hi ,
I am new to gnu-win32 .  I have the following prob:  
while forking ( ver - b18  .)

/* Example Code*/
int main()
{
int x;
if(  !fork() ) 
  printf("Child\n" );
else
  printf("Parent\n");

/* If wait is commented out  the program shows errors*/
wait( &x ) ;
return x ;
}

The the above code works fine BUT IF wait() is commented out  the program
becomes unpredictable ( sometimes it works ...  sometimes
shows  EXCEPTION TRAPPED ... I think it depends on which process finishes
first - chid || parent  .
 
Is the above behaviour a  bug  or is 
this the way fork() is supposed to work in cygwin

Is there a workaround ?????
thanx 

Soumen 
sbiswas AT novell DOT com

 
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019