diff options
Diffstat (limited to 'modules/examples/mod_example_ipc.c')
-rw-r--r-- | modules/examples/mod_example_ipc.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/modules/examples/mod_example_ipc.c b/modules/examples/mod_example_ipc.c index b8ba569c06..a7cdb34d1b 100644 --- a/modules/examples/mod_example_ipc.c +++ b/modules/examples/mod_example_ipc.c @@ -91,7 +91,8 @@ typedef struct exipc_data { * on restarts. It assures that the new children will not talk to a stale * shared memory segment. */ -static apr_status_t shm_cleanup_wrapper(void *unused) { +static apr_status_t shm_cleanup_wrapper(void *unused) +{ if (exipc_shm) return apr_shm_destroy(exipc_shm); return OK; @@ -248,10 +249,12 @@ static int exipc_handler(request_rec *r) rs = apr_global_mutex_trylock(exipc_mutex); if (APR_STATUS_IS_EBUSY(rs)) { apr_sleep(CAMPOUT); - } else if (APR_SUCCESS == rs) { + } + else if (APR_SUCCESS == rs) { gotlock = 1; break; /* Get out of the loop */ - } else if (APR_STATUS_IS_ENOTIMPL(rs)) { + } + else if (APR_STATUS_IS_ENOTIMPL(rs)) { /* If it's not implemented, just hang in the mutex. */ startcamp = apr_time_now(); rs = apr_global_mutex_lock(exipc_mutex); @@ -259,21 +262,23 @@ static int exipc_handler(request_rec *r) if (APR_SUCCESS == rs) { gotlock = 1; break; /* Out of the loop */ - } else { + } + else { /* Some error, log and bail */ ap_log_error(APLOG_MARK, APLOG_ERR, rs, r->server, "Child %ld failed to acquire lock", (long int)getpid()); break; /* Out of the loop without having the lock */ } - } else { + } + else { /* Some other error, log and bail */ ap_log_error(APLOG_MARK, APLOG_ERR, rs, r->server, "Child %ld failed to try and acquire lock", (long int)getpid()); break; /* Out of the loop without having the lock */ - } + /* * The only way to get to this point is if the trylock worked * and returned BUSY. So, bump the time and try again @@ -307,7 +312,8 @@ static int exipc_handler(request_rec *r) ap_rprintf(r, "<tr><td>Counter:</td><td>%u</td></tr>\n", (unsigned int)base->counter); ap_rputs("</table>\n", r); - } else { + } + else { /* * Send a page saying that we couldn't get the lock. Don't say * what the counter is, because without the lock the value could @@ -348,4 +354,3 @@ AP_DECLARE_MODULE(example_ipc) = { NULL, /* table of config file commands */ exipc_register_hooks /* register hooks */ }; - |