On LWLockDisown():
> +/*
> + * Stop treating lock as held by current backend.
> + *
> + * After calling this function it's the callers responsibility to ensure that
> + * the lock gets released, even in case of an error. This only is desirable if
> + * the lock is going to be released in a different process than the process
> + * that acquired it.
> + *
> + * Returns the mode in which the lock was held by the current backend.
Returning the lock mode feels a bit ad hoc..
> + * NB: This will leave lock->owner pointing to the current backend (if
> + * LOCK_DEBUG is set). We could add a separate flag indicating that, but it
> + * doesn't really seem worth it.
Hmm. I won't insist, but I feel it probably would be worth it. This is
only in LOCK_DEBUG mode so there's no performance penalty in non-debug
builds, and when you do compile with LOCK_DEBUG you probably appreciate
any extra information.
> + * NB: This does not call RESUME_INTERRUPTS(), but leaves that responsibility
> + * of the caller.
> + */
That feels weird. The only caller outside lwlock.c does call
RESUME_INTERRUPTS() immediately.
Perhaps it'd make for a better external interface if LWLockDisown() did
call RESUME_INTERRUPTS(), and there was a separate internal version that
didn't. And it might make more sense for the external version to return
'void' while we're at it. Returning a value that the caller ignores is
harmless, of course, but it feels a bit weird. It makes you wonder what
you're supposed to do with it.
> + {
> + {"io_method", PGC_POSTMASTER, RESOURCES_MEM,
> + gettext_noop("Selects the method of asynchronous I/O to use."),
> + NULL
> + },
> + &io_method,
> + DEFAULT_IO_METHOD, io_method_options,
> + NULL, assign_io_method, NULL
> + },
> +
The description is a bit funny because synchronous I/O is one of the
possible methods.
--
Heikki Linnakangas
Neon (https://neon.tech)