Ruediger Pluem wrote:

+        }
+        if (w->is_running && w->callbacks == NULL) {
+            /* This is hook mode watchdog
+             * running on WatchogInterval
+             */
+            w->step += (apr_time_now() - curr);
+            if (w->step >= wd_interval) {
+                if (!ctx)
+                    apr_pool_create(&ctx, w->pool);

Is this check really needed? ctx should be always NULL here.


Yes, it's NULL, but only for the first callback.
If there are multiple callbacks they will all use
the same pool for this call.
Also, pool gets created only if one of the callbacks
actually times out.

+
+    /* This mutex fixes problems with a fast start/fast end, where the pool
+     * cleanup was being invoked before the thread completely spawned.
+     */

Can you elaborate this a bit more (maybe with an example)?
I currently do not understand which problem is solved here.


Well, I reused the mod_heartbeat code here, and I think it's
very useful to ensure the thread actually gets created and
running before we allow to kill the child.

+    apr_thread_mutex_lock(w->startup);
+
+    /* Start the newly created watchdog */
+    rc = apr_thread_create(&w->thread, NULL, wd_worker, w, p);
+    if (rc) {
+        apr_pool_cleanup_kill(p, w, wd_worker_cleanup);

I don't see that this cleanup gets registered anywhere.


That got slipped during copy/paste from my dev branch.
Fixed, thanks.


Regards
--
^(TM)

Reply via email to