Re: C based plugins, clocks, locks, and configuration variables
От | Craig Ringer |
---|---|
Тема | Re: C based plugins, clocks, locks, and configuration variables |
Дата | |
Msg-id | CAMsr+YFEpmCAKgoiU=OhnwZXV3SmL-eRKShgDoDTpsaeBoJiKQ@mail.gmail.com обсуждение исходный текст |
Ответ на | C based plugins, clocks, locks, and configuration variables (Clifford Hammerschmidt <tanglebones@gmail.com>) |
Ответы |
Re: C based plugins, clocks, locks, and configuration
variables
|
Список | 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 по дате отправления: