shithub: 9intro

ref: a351bcdccdf5a4273bc8dc3360a48fbb8b8aa9ea
dir: /src/rendez.c/

View raw version
void
main(int, char*[])
{
	int	i;
	int	childsts;

	switch(rfork(RFPROC|RFNOTEG|RFNOWAIT)){
	case 0:
		if (httpinit() < 0)
			rendezvous(&main, (void*)-1);
		else
			rendezvous(&main, (void*)0);
		httpservice();	// do the job.
		exits(nil);
	case -1:
		sysfatal("rfork: %r");
	default:
		childsts = (int)rendezvous(&main, (void*)0);
		if (childsts == 0)
			exits(nil);
		else {
			fprint(2, "httpinit failed\n");
			exits("httpinit failed");
		}
	}
}