You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Jacob Champion <ch...@gmail.com> on 2017/06/01 23:26:42 UTC

Is there a feature macro for cross-process-capable atomics?

Hi all,

I'd like to be able to use the apr_atomic primitives for cross-process 
work in shared memory, but as far as I can see, not every implementation 
is guaranteed to work across processes (for example, the generic 
implementation uses apr_thread_mutex*).

I'd be fine falling back to a heavyweight implementation if a platform 
truly needed it, but I can't find a way to "query" characteristics of 
the atomics implementation, so the fallback unfortunately has to be the 
default. Is there a feature macro I'm missing somewhere?

--Jacob

Re: Is there a feature macro for cross-process-capable atomics?

Posted by Jacob Champion <ch...@gmail.com>.
On 06/02/2017 04:18 PM, Yann Ylavic wrote:
> Looks like there is none :/

That's what I figured; thanks for confirming.

> OTOH, I don't see which platform use generic (mutex) atomics by
> default, they have to be force_generic_atomics=yes at ./configure time
> or -DUSE_ATOMICS_GENERIC at compile time...

Hmm, is the generic implementation the only one that's not guaranteed to 
work cross-process? And is there a way to bake that guarantee into the 
published API?

At the moment, unfortunately, I don't think I can rely on "unlikely to 
happen" -- a key use case of mod_websocket is embedded devices, which 
are arguably more likely to be using atypical/custom configurations. 
Perhaps I can have users opt in using a configure switch...

Thanks!

--Jacob

Re: Is there a feature macro for cross-process-capable atomics?

Posted by Yann Ylavic <yl...@gmail.com>.
Hi Jacob,

On Fri, Jun 2, 2017 at 1:26 AM, Jacob Champion <ch...@gmail.com> wrote:
>
> I'd like to be able to use the apr_atomic primitives for cross-process work
> in shared memory, but as far as I can see, not every implementation is
> guaranteed to work across processes (for example, the generic implementation
> uses apr_thread_mutex*).
>
> I'd be fine falling back to a heavyweight implementation if a platform truly
> needed it, but I can't find a way to "query" characteristics of the atomics
> implementation, so the fallback unfortunately has to be the default. Is
> there a feature macro I'm missing somewhere?

Looks like there is none :/
OTOH, I don't see which platform use generic (mutex) atomics by
default, they have to be force_generic_atomics=yes at ./configure time
or -DUSE_ATOMICS_GENERIC at compile time...


Regards,
Yann.