Re: ✘64-bit time_t on glibc 2.34 and up

James Browning jamesb192 at jamesb192.com
Fri Jan 13 21:43:38 UTC 2023


> On 01/13/2023 1:06 PM PST Hal Murray <halmurray at sonic.net> wrote:
> 
> 
> If we make any changes to SHM, we should switch to a setup where the memory is
> read only. The idea is to allow multiple readers.
> 
> The trick to implementing that is to have 2 counters.
> X and Y are initialized to the same value.
> The writer bumps X, updates the data, then bumps Y.
> The reader grabs Y, grabs the data, then grabs X.
> If X and Y are the same the data is valid. If not, try again.

I've heard you mention this before, and I specced it
by calling them bookends instead and sticking them at
opposite ends of a 4KiB page-sized struct.


More information about the devel mailing list