| 266 | } |
| 267 | |
| 268 | static apr_status_t wd_startup(ap_watchdog_t *w, apr_pool_t *p) |
| 269 | { |
| 270 | apr_status_t rc; |
| 271 | |
| 272 | apr_atomic_set32(&w->thread_started, 0); |
| 273 | |
| 274 | if (w->singleton) { |
| 275 | /* Initialize singleton mutex in child */ |
| 276 | rc = apr_proc_mutex_child_init(&w->mutex, |
| 277 | apr_proc_mutex_lockfile(w->mutex), p); |
| 278 | if (rc != APR_SUCCESS) |
| 279 | return rc; |
| 280 | } |
| 281 | |
| 282 | /* Start the newly created watchdog */ |
| 283 | rc = ap_thread_create(&w->thread, NULL, wd_worker, w, p); |
| 284 | if (rc == APR_SUCCESS) { |
| 285 | apr_pool_pre_cleanup_register(p, w, wd_worker_cleanup); |
| 286 | } |
| 287 | |
| 288 | return rc; |
| 289 | } |
| 290 | |
| 291 | static apr_status_t ap_watchdog_get_instance(ap_watchdog_t **watchdog, |
| 292 | const char *name, |
no test coverage detected