home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / pp / pp-6.0 / Lib / util / tryfork.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-12-18  |  532 b   |  29 lines

  1. /* tryfork: attempt to fork a child - makes several attempts */
  2.  
  3. # ifndef lint
  4. static char Rcsid[] = "@(#)$Header: /xtel/pp/pp-beta/Lib/util/RCS/tryfork.c,v 6.0 1991/12/18 20:25:18 jpo Rel $";
  5. # endif
  6.  
  7. /*
  8.  * $Header: /xtel/pp/pp-beta/Lib/util/RCS/tryfork.c,v 6.0 1991/12/18 20:25:18 jpo Rel $
  9.  *
  10.  * $Log: tryfork.c,v $
  11.  * Revision 6.0  1991/12/18  20:25:18  jpo
  12.  * Release 6.0
  13.  *
  14.  */
  15.  
  16.  
  17.  
  18. #include "util.h"
  19.  
  20. int tryfork()
  21. {
  22.     int     i, pid;
  23.  
  24.     for(i = 0; i < MAXFORK; sleep(1), i++)
  25.         if((pid = fork()) != -1)
  26.             break;
  27.     return pid;
  28. }
  29.