下面的创建很多进程是能用到的,比较巧妙的方法,以前也见过。现在给摘录下来。
#ifdef HAVE_FORK
/* start watcher and workers */
num_childs = srv->srvconf.max_worker;
if (num_childs > 0) {
int child = 0;
while (!child && !srv_shutdown) {
if (num_childs > 0) {
switch (fork()) {
case -1:
return -1;
case 0: