FastCGI Developer's Kit README
------------------------------
- $Id: README,v 1.17 2002/02/24 20:12:21 robs Exp $
+ $Id: README,v 1.18 2002/02/28 15:21:25 robs Exp $
Copyright (c) 1996 Open Market, Inc.
See the file "LICENSE.TERMS" for information on usage and redistribution
of this file, and for a DISCLAIMER OF ALL WARRANTIES.
2.2.3
-----
+
+ *) [WIN32] force an exit from the ShutdownRequestThread when a shutdown is
+ signaled and NamedPipes are in use.
+
*) Use streamsize and char_type in the C++ API.
*) [WIN32] Eliminate the (partial and broken) use of OverlappedIO - this
* significantly more enjoyable.)
*/
#ifndef lint
-static const char rcsid[] = "$Id: os_win32.c,v 1.30 2002/02/25 13:17:27 robs Exp $";
+static const char rcsid[] = "$Id: os_win32.c,v 1.31 2002/02/28 15:21:26 robs Exp $";
#endif /* not lint */
#define WIN32_LEAN_AND_MEAN
shutdownPending = TRUE;
}
-/* XXX Need a shutdown now event */
static void ShutdownRequestThread(void * arg)
{
HANDLE shutdownEvent = (HANDLE) arg;
+ DWORD rv;
- if (WaitForSingleObject(shutdownEvent, INFINITE) == WAIT_FAILED)
- {
- // Assuming it will happen again, all we can do is exit the thread
- }
- else
+ WaitForSingleObject(shutdownEvent, INFINITE);
+
+ shutdownPending = TRUE;
+
+ if (listenType == FD_PIPE_SYNC)
{
- // "Simple reads and writes to properly-aligned 32-bit variables are atomic"
- shutdownPending = TRUE;
-
- // Before an accept() is entered the shutdownPending flag is checked.
- // If set, OS_Accept() will return -1. If not, it waits
- // on a connection request for one second, checks the flag, & repeats.
- // Only one process/thread is allowed to do this at time by
- // wrapping the accept() with mutex.
+ // Its a hassle to get ConnectNamedPipe to return early,
+ // so just wack the whole process - yes, this will toast
+ // any requests in progress, but at least its a clean
+ // shutdown (its better than TerminateProcess())
+ exit(0);
}
+
+ // FD_SOCKET_SYNC: When in Accept(), select() is used to poll
+ // the shutdownPending flag - yeah this isn't pretty either
+ // but its only one process doing it if an Accept mutex is used.
+ // This at least buys no toasted requests.
}
/*