Re: atomic reads & writes (with no barriers)

From: Kevin Grittner <kgrittn(at)gmail(dot)com>
To: Greg Stark <stark(at)mit(dot)edu>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: atomic reads & writes (with no barriers)
Date: 2015-12-04 14:37:53
Message-ID: CACjxUsPUO7xc6S49OF7YbzZqxFRLt3Mm3U=5AFFufyweJ15zEQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Dec 4, 2015 at 6:35 AM, Greg Stark <stark(at)mit(dot)edu> wrote:
> On Thu, Dec 3, 2015 at 10:10 PM, Kevin Grittner <kgrittn(at)gmail(dot)com> wrote:
>> Is the c.h change above on anything resembling the right track for
>> a patch for this? If not, what would such a patch look like?
>
> It would be nicer if we could come up with an interface that didn't
> require #ifdefs everywhere it's used.
>
> Something like
> ...
> pg_maybe_atomic int64 threshold_timestamp;
> ...
>
> SpinLockAcquire_if_no_atomics(...)
> threshold_timestamp = &oldSnapshotControl->threshold_timestamp;
> SpinLockRelease_if_no_atomics(...)
>
> return threshold_timestamp;

Yeah, I didn't much like including the #ifdefs everywhere; I like
your suggestions. Will work up a patch for the next CF along those
lines.

Thanks!

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2015-12-04 14:45:58 Re: [DOCS] max_worker_processes on the standby
Previous Message Ildus Kurbangaliev 2015-12-04 14:17:26 Re: Support of partial decompression for datums