Skip to content

Commit 3e9dc41

Browse files
committed
fixed MAX_SPAWN_HANDLES to MAXIMUM_WAIT_OBJECTS, added SetProcessShutdownParameters to avoid rerun cgis at shutdown
1 parent bf312f4 commit 3e9dc41

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

example/php-cgi-spawner.exe

0 Bytes
Binary file not shown.

src/php-cgi-spawner.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ __forceinline void memzero( void * mem, size_t size ) // anti memset
1313
while( size );
1414
}
1515

16-
#define MAX_SPAWN_HANDLES 256
16+
#define MAX_SPAWN_HANDLES MAXIMUM_WAIT_OBJECTS
1717

1818
__forceinline void spawner( char * app, unsigned port, unsigned cgis )
1919
// based on spawn-fcgi-win32.c
@@ -60,6 +60,10 @@ __forceinline void spawner( char * app, unsigned port, unsigned cgis )
6060
if( -1 == listen( s, SOMAXCONN ) )
6161
return;
6262

63+
// close prior to cgis (msdn: All processes start at shutdown level 0x280)
64+
if( !SetProcessShutdownParameters( 0x380, SHUTDOWN_NORETRY ) )
65+
return;
66+
6367
{
6468
HANDLE hProcesses[MAX_SPAWN_HANDLES];
6569
PROCESS_INFORMATION pi;

src/php-cgi-spawner.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
2 ICON "php-cgi-spawner.ico"
44

5-
#define PCS_VERSION 1,15,8,13
5+
#define PCS_VERSION 1,15,8,18
66
#define PCS_VERSION_STR "4K\0"
77

88
VS_VERSION_INFO VERSIONINFO

0 commit comments

Comments
 (0)