http://httpd.apache.org/docs/2.2/new_features_2_2.html Doc says: Monitor hook added Monitor hook enables modules to run regular/scheduled jobs in the parent (root) process. but mpm_winnt doesn't call monitor hook.
Win32 doesn't have the same process separation model as unix, so this one isn't trivial to solve. It would seem trivial to execute this monitor in the 'parent'. However, the parent actually isn't interrelated to the children in the same way as on unix. On Windows, there is a process loop in the child itself which does all of the work, and the parent simply pauses until the child dies, or until the server is told to shut down (and it signals the child as such). So... the answer would appear to be, add the monitor hook to the parent. But we need to be aware that things like the error log, listening sockets etc, are actually being controlled by the child at that point. So more information on your use case would be very interesting, since it's really the users that dictate how we should fix this.
Interestingly, neither do BeOS, OS2 or the Event MPM's, because that hook is entirely predicated on AP_MPM_WANT_WAIT_OR_TIMEOUT. It appears that a minimal parent-process implementation would add /* number of calls to wait_or_timeout between writable probes, * which means nothing other than monitor hook callbacks on win32 */ #ifndef INTERVAL_OF_WRITABLE_PROBES #define INTERVAL_OF_WRITABLE_PROBES 10 #endif and replace rv = WaitForMultipleObjects(NUM_WAIT_HANDLES, (HANDLE *) event_handles, FALSE, INFINITE); with do { rv = WaitForMultipleObjects(NUM_WAIT_HANDLES, (HANDLE *) event_handles, FALSE, SCOREBOARD_MAINTENANCE_INTERVAL / INTERVAL_OF_WRITABLE_PROBES / 1000); ap_run_monitor(p); } while (rv == WAIT_TIMEOUT); where mpm_winnt already defines SCOREBOARD_MAINTENANCE_INTERVAL as 1000000.
As far as I can determine, monitor_hook is not a documented feature and isn't implied to be supported except as it's needed by a specific MPM. This is true of many functions defined in mpm_common.h, an internal header. But I'll leave this as an enhancement bug; and if that hook is ever defined, we'll know better if it should run under the parent process, child process or both.
Thanks to reply (In reply to comment #1) > So more information on your use case would be very interesting, since it's > really the users that dictate how we should fix this. I make a link list on normal memory (on Windows) or shared memory (on Unix). On each request an element is allocated from it and input/output filter write a status on the element. After the request an element is left as "used" in, e.g., three minutes. I want to run Gabage Collecter on monitor hook. (In reply to comment #3) > This is true of many functions defined in mpm_common.h, an internal header. mpm_common.h is internal? Installed apache2/include contains mpm_common.h so I thought it was public header.