Hi all,
I've got some response which shows that I was not clear enough in my previous
post. Fullproof solution would be:
Index: server/mpm/worker/worker.c
===================================================================
--- server/mpm/worker/worker.c (revision 545597)
+++ server/mpm/worker/worker.c (working copy)
@@ -892,7 +887,7 @@
bucket_alloc = apr_bucket_alloc_create(ptrans);
process_socket(ptrans, csd, process_slot, thread_slot, bucket_alloc);
worker_sockets[thread_slot] = NULL;
- requests_this_child--; /* FIXME: should be synchronized - aaron */
+ apr_atomic_dec32(&requests_this_child); /* much slower than important
*/
apr_pool_clear(ptrans);
last_ptrans = ptrans;
}
Because we don't care about if (requests_this_child <= 0) it would be enough. But
it is too way slow and is not so important.
So, the question is:
If on x86 we have native atomic 'subl $0x1,mem' which is almost as fast as
optimized mov dec mov, why not to use platform specific feature. As for now x86
represents majority of hosts.
PS I have found 21 atomic dec/inc in trunk and more than half of them are about
counters similar to the case above.
--
Best regards,
Dmytro