Boost logo

Boost :

Subject: Re: [boost] [rfc] lockfree API/naming suggestions
From: Giovanni Piero Deretta (gpderetta_at_[hidden])
Date: 2011-11-29 13:18:17


On Tue, Nov 29, 2011 at 5:39 PM, Tim Blechmann <tim_at_[hidden]> wrote:
>
> dave:
>> If it were me, I wouldn't label anything "unsafe," since presumably even
>> the push you're calling unsafe is as threadsafe as int, and it seems
>> like the right prefix for the nonblocking one is "try_".  I might use
>> ("push", "atomic_push," "try_push") or if the use of the single-threaded
>> version is rare enough, ("single_thread_push"/"serial_push", "push",
>> "try_push").
>
> "atomic" does have some a different meaning then what is implemented (afaict,
> `linearizable' would be the correct term).
>
> i'd like to avoid the name "try_", because all push operations may actually
> fail. "push" and "push_unsafe" can fail if ringbuffer (aka spsc_queue) space
> is exhausted or memory allocation fails (queue/stack). "push_nonblocking" may
> fail, if the internal memory pool is exhausted.
>
> "single_thread_push" might cause some misunderstanding, as people may think
> that it is about a `single producer', not about a `single-threaded use'. so it
> is really a "thread_unsafe_push", as incorrect use may corrupt the internal
> data structure.
>
> so maybe "thread_unsafe_push", "nonblocking_push" and "push"?
>

if there is resistance for unsafe_push, I propose push_unsynchronized
(or unsynchronized_push).

-- 
gpd

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk