Deutsch English Français Italiano |
<vfqgrc$1hfo1$2@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: jseigh <jseigh_es00@xemaps.com> Newsgroups: comp.lang.c++ Subject: Re: smrproxy v2 Date: Tue, 29 Oct 2024 07:27:40 -0400 Organization: A noiseless patient Spider Lines: 30 Message-ID: <vfqgrc$1hfo1$2@dont-email.me> References: <vequrc$2o7qc$1@dont-email.me> <verr04$2stfq$1@dont-email.me> <verubk$2t9bs$1@dont-email.me> <ves78h$2ugvm$2@dont-email.me> <vetj1f$39iuv$1@dont-email.me> <vfh4dh$3bnuq$1@dont-email.me> <vfh7mg$3c2hs$1@dont-email.me> <vfm4iq$ill4$1@dont-email.me> <vfmesn$k6mn$1@dont-email.me> <vfmf21$kavl$1@dont-email.me> <vfmm9a$lob3$1@dont-email.me> <vfn2di$r8ca$1@dont-email.me> <vfntgb$vete$1@dont-email.me> <vfp1c3$16d9f$1@dont-email.me> <vfpd43$186t4$1@dont-email.me> <vfporh$1dqvu$2@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Tue, 29 Oct 2024 12:27:40 +0100 (CET) Injection-Info: dont-email.me; posting-host="ac8ee95b19a1901ed81555f68070b1d5"; logging-data="1621761"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/E98tBx8DmQ82WvxcLa/Fb" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:Bzh8ADa+m22nXsewJVLJ1xz5iVI= In-Reply-To: <vfporh$1dqvu$2@dont-email.me> Content-Language: en-US Bytes: 2512 On 10/29/24 00:38, Chris M. Thomasson wrote: > On 10/28/2024 6:17 PM, jseigh wrote: >> On 10/28/24 17:57, Chris M. Thomasson wrote: >>> On 10/28/2024 4:45 AM, jseigh wrote: >> >> fwiw, here's the lock and unlock logic from smrproxy rewrite >> >> inline void lock() >> { >> epoch_t _epoch = shadow_epoch.load(std::memory_order_relaxed); >> _ref_epoch.store(_epoch, std::memory_order_relaxed); >> std::atomic_signal_fence(std::memory_order_acquire); >> } >> >> inline void unlock() >> { >> _ref_epoch.store(0, std::memory_order_release); >> } >> >> epoch_t is interesting. It's uint64_t but handles wrapped >> compares, ie. for an epoch_t x1 and uint64_t n > > Only your single polling thread can mutate the shadow_epoch, right? > Yes. It's just an optimization. The reader threads could read from the global epoch but it would be in a separate cache line and be an extra dependent load. So one dependent load and same cache line.