Re: C based plugins, clocks, locks, and configuration variables - Mailing list pgsql-hackers

From Craig Ringer
Subject Re: C based plugins, clocks, locks, and configuration variables
Date
Msg-id CAMsr+YFEpmCAKgoiU=OhnwZXV3SmL-eRKShgDoDTpsaeBoJiKQ@mail.gmail.com
Whole thread Raw
In response to C based plugins, clocks, locks, and configuration variables  (Clifford Hammerschmidt <tanglebones@gmail.com>)
Responses Re: C based plugins, clocks, locks, and configuration variables
List pgsql-hackers
<p dir="ltr"><p dir="ltr">On 4 Nov. 2016 06:05, "Clifford Hammerschmidt" <<a
href="mailto:tanglebones@gmail.com">tanglebones@gmail.com</a>>wrote:<br /> ><br /> > Hi all,<br /> ><br />
>Apologies in advance if this isn't the right place to be posting this.<br /> ><br /> > I've started work on a
pluginin C (<a href="https://github.com/tanglebones/pg_tuid">https://github.com/tanglebones/pg_tuid</a>) for generating
generallymonotonically ascending UUIDs (aka TUIDs), and after googling around I couldn't find any guidence on a few
things.(It's hard to google for anything in the postgres C api as most results coming back are for using postgres
itself,not developing plugins for postgres.)<br /> ><br /> > I'm looking for the idiomatic (and portable) way
of:<br/> ><br /> > 1) getting microseconds (or nanoseconds) from UTC epoch in a plugin<p
dir="ltr">GetCurrentIntegerTimestamp()<pdir="ltr">> 2) getting an exclusive lock for a user plugin to serialize
accessto its shared state (I'm assuming that plugins must be reentrant)<p dir="ltr">Allocate an LWLock in your shared
memorysegment and use it to arbitrate access. Multiple examples in contrib. Lwlock allocation infonin developer docs.<p
dir="ltr">>3) creating a configuration variable for a plugin and accessing its values in the plugin. (e.g. `set
plugin.configuration_variable=1`or somesuch)<p dir="ltr">DefineCustomIntegerVariable etc (I think, name not exactly
right?On phone). See guc.h .<br /> 

pgsql-hackers by date:

Previous
From: Haribabu Kommi
Date:
Subject: Re: macaddr 64 bit (EUI-64) datatype support
Next
From: Robert Haas
Date:
Subject: Re: Declarative partitioning - another take