1998-01-21
1998-01-21 04:33:51 by Henrik Grubbström (Grubba) <grubba@grubba.org>
-
abdc63a3a3ce8c08ab9537d219cdd67daaa7071b
(20 lines)
(+17/-3)
[
Show
| Annotate
]
Branch: 5.2
fork_or_quit() now handles that fork() doesn't exist.
Rev: server/base_server/roxen.pike:1.158
1:
- constant cvs_version = "$Id: roxen.pike,v 1.157 1998/01/17 02:57:19 grubba Exp $";
+ constant cvs_version = "$Id: roxen.pike,v 1.158 1998/01/21 04:33:51 grubba Exp $";
#define IN_ROXEN
#include <roxen.h>
#include <config.h>
90: Inside #if defined(SOCKET_DEBUG)
#ifdef SOCKET_DEBUG
perror("SOCKETS: fork_or_quit()\n Bye!\n");
#endif
+
+ #if constant(fork) && !defined(THREADS)
+
if(fork())
exit(-1); // Restart.
// Now we're running in the forked copy.
- // FIXME: This probably doesn't work correctly on threaded servers.
+ // FIXME: This probably doesn't work correctly on threaded servers,
+ // since only one thread is left running after the fork().
#if efun(_pipe_debug)
call_out(lambda() { // Wait for all connections to finish
call_out(Simulate.this_function(), 20);
if(!_pipe_debug()[0]) exit(0);
}, 1);
- #endif
+ #endif /* efun(_pipe_debug) */
call_out(lambda(){ exit(0); }, 600); // Slow buggers..
f=indices(portno);
for(i=0; i<sizeof(f); i++)
catch(destruct(f[i]));
-
+ #else /* !constant(fork) */
+
+ // FIXME:
+ // Should probably attempt something similar to the above,
+ // but this should be sufficient for the time being.
+
+ exit(-1); // Restart
+
+ #endif /* constant(fork) */
}
// Keep a count of how many times in a row there has been an error