Implement [ap_]atomics for [u]int/[u]long/size_t and use them for (some) proxy_worker_shared fields #396
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Follow up to https://lists.apache.org/thread/np1xzvq6yq5onmtqqovyx0doncowvp3f
This is a proposal/POC to implement [ap_]atomics on system dependent signed/unsigned types, using the uint32/uint66/ptr atomics from the APR as primitives.
This currently implements:
The add/sub functions wrap on under/overflow (safely for signed types), while the add_sat/sub_sat ones saturate instead (e.g. at INT_MIN/INT_MAX for ints, at 0/ULONG_MAX for unsigned longs, ...).
This allows to replace/remove the
ap_proxy_{get,set,dec,inc}_busy_count()
specialized functions by using the newap_atomic_size_*()
helpers directly on worker->s->busy, and likewise to use the the newap_atomic_int_*()
directly on worker->s->lbstatus to switch to atomic ops there too.TODO: dox, MMNs..