--------------------- PatchSet 6723 Date: 2005/08/19 07:40:57 Author: serassio Branch: nt-2_5 Tag: (none) Log: Added Windows support for sleep_after_fork configuration directive Members: src/ipc.c:1.7.10.13->1.7.10.14 Index: squid/src/ipc.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/ipc.c,v retrieving revision 1.7.10.13 retrieving revision 1.7.10.14 diff -u -r1.7.10.13 -r1.7.10.14 --- squid/src/ipc.c 8 Oct 2003 20:32:18 -0000 1.7.10.13 +++ squid/src/ipc.c 19 Aug 2005 07:40:57 -0000 1.7.10.14 @@ -1,6 +1,6 @@ /* - * $Id: ipc.c,v 1.7.10.13 2003/10/08 20:32:18 serassio Exp $ + * $Id: ipc.c,v 1.7.10.14 2005/08/19 07:40:57 serassio Exp $ * * DEBUG: section 54 Interprocess Communication * AUTHOR: Duane Wessels @@ -100,6 +100,7 @@ struct ipc_params params; int opt; int optlen = sizeof(opt); + DWORD ecode = 0; #endif pid_t pid; struct sockaddr_in CS; @@ -344,19 +345,24 @@ fd_table[pwfd].flags.ipc = 1; fd_table[crfd].flags.ipc = 1; fd_table[cwfd].flags.ipc = 1; - { - DWORD ecode = 0; - if (GetExitCodeThread((HANDLE) thread, &ecode) && ecode == STILL_ACTIVE) { - if (hIpc) - *hIpc = (HANDLE) thread; - if (ppid) - *ppid = pid; - return pwfd; - } else { - CloseHandle((HANDLE)thread); - return ipcCloseAllFD(prfd, pwfd, -1, -1); - } - } + if (Config.sleep_after_fork) { + /* XXX emulation of usleep() */ + DWORD sl; + sl = Config.sleep_after_fork / 1000; + if (sl == 0) + sl = 1; + Sleep(sl); + } + if (GetExitCodeThread((HANDLE) thread, &ecode) && ecode == STILL_ACTIVE) { + if (hIpc) + *hIpc = (HANDLE) thread; + if (ppid) + *ppid = pid; + return pwfd; + } else { + CloseHandle((HANDLE)thread); + return ipcCloseAllFD(prfd, pwfd, -1, -1); + } #else fd_table[prfd].flags.ipc = 1; fd_table[pwfd].flags.ipc = 1;