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

From Clifford Hammerschmidt
Subject C based plugins, clocks, locks, and configuration variables
Date
Msg-id CANvN6gxJ9itXZzPYBjNZeXQfc1F1fR+pYgWY=4P6a6HkeGcO8Q@mail.gmail.com
Whole thread Raw
Responses Re: C based plugins, clocks, locks, and configuration variables
List pgsql-hackers
Hi all,

Apologies in advance if this isn't the right place to be posting this.

I've started work on a plugin in C (https://github.com/tanglebones/pg_tuid) for generating generally monotonically 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.)

I'm looking for the idiomatic (and portable) way of:

1) getting microseconds (or nanoseconds) from UTC epoch in a plugin
2) getting an exclusive lock for a user plugin to serialize access to its shared state (I'm assuming that plugins must be reentrant)
3) creating a configuration variable for a plugin and accessing its values in the plugin. (e.g. `set plugin.configuration_variable=1` or somesuch)

Thanks,

-- 
Clifford Hammerschmidt, P.Eng.

pgsql-hackers by date:

Previous
From: Artur Zakirov
Date:
Subject: Re: [PATCH] Generic type subscription
Next
From: Tom Lane
Date:
Subject: Re: Improving RLS planning