🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c++
Article #27

Re: Consequential RCU

#27
From: Chris M. Thomasson
Date: Wed, 07 Oct 2026 20:17
39 lines
3229 bytes
On 10/7/2026 6:26 AM, Bonita Montero wrote:
> This is an example where I used my shared_obj<T>, which is constantly
> poll-updated from a tshared_obj<T>. As long as the latter doesn't change
> this is nearly for free.
> 
> template<bool Utc, bool AlsoEqual>
> auto date_1601::lookUpLeap( int64_t ts ) noexcept -> lulp_ret
> {
>      thread_local shared_obj<leaps_set, sobj_mode::All> pLeaps;
>      pLeaps = g_leapSeconds; // update
>      span leaps = pLeaps->m_leaps;
>      auto
>          itBegin = leaps.rbegin(),
>          itEnd = leaps.rend(),
>          itBefore = itBegin;
>      if constexpr( AlsoEqual )
>          itBefore = lower_bound( itBegin, itEnd, ts, []( const 
> dual_deaps &leap, int64_t ref ) { return leap[Utc] > ref; } );
>      else
>          itBefore = upper_bound( itBegin, itEnd, ts, []( int64_t ref, 
> const dual_deaps &leap ) { return ref > leap[Utc]; } );
>      if( itBefore == itEnd )
>          return lulp_ret( -1, 0 );
>      return lulp_ret( leaps.rend() - itBefore - 1, (*itBefore)[Utc] );
> }
> 
> In this example I'm dealing with a central storage of leap seconds which
> may been updated asynchronously. This updates woudln't happen so often,
> meaning the commented update assingment is nearly for free.
> 


Can you iterate a shared single linked list with basically zero overhead?

  thread_local shared_obj<leaps_set, sobj_mode::All> pLeaps;

? So, are you taking a reference to something the thread does not own? I 
noticed you mentioned futex. But that implies waiting! Or else why use 
it to begin with?
Technical Details
Message-ID: <11a69ct$377dl$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <118f4vv$3plsv$1@dont-email.me> <11a0l38$150m3$1@raubtier-asyl.eternal-september.org> <11a0odn$16c2e$1@dont-email.me> <11a0tf5$18frd$1@raubtier-asyl.eternal-september.org> <11a4i3l$2i092$3@dont-email.me> <11a5fpa$2sm77$1@raubtier-asyl.eternal-september.org> <11a5h9j$2t9s2$1@raubtier-asyl.eternal-september.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Newsgroups: comp.lang.c++
Subject: Re: Consequential RCU
Date: Wed, 7 Oct 2026 13:17:29 -0700
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <11a69ct$377dl$1@dont-email.me>
References: <118f4vv$3plsv$1@dont-email.me>
 <11a0l38$150m3$1@raubtier-asyl.eternal-september.org>
 <11a0odn$16c2e$1@dont-email.me>
 <11a0tf5$18frd$1@raubtier-asyl.eternal-september.org>
 <11a4i3l$2i092$3@dont-email.me>
 <11a5fpa$2sm77$1@raubtier-asyl.eternal-september.org>
 <11a5h9j$2t9s2$1@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 07 Oct 2026 20:17:34 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="3382709"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/8yOLChgbEWJqG+3YUziVKIaqwrjx6Dvg="; posting-host="9e5dad94c1931ab85b8ca42122ca3b99"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:lZWy53k9dkvlRLtG+61LtOnLprE= sha256:smrLo1s2UIJPYXUqIi4ZNfVrPTDxWwmmQoikIAuntEU=
	sha1:+6f21c7D8Rp8EpfMav9Z686i1AY= sha256:FXbRx3aPqPh55sucFCbVcBNRw+rGZnw6NnWXKNJY3s4=
Content-Language: en-US
In-Reply-To: <11a5h9j$2t9s2$1@raubtier-asyl.eternal-september.org>