From b5d0f8ec01c021452203b2fd3921c9b55f6c3cd3 Mon Sep 17 00:00:00 2001 From: Thomas Munro Date: Fri, 23 Dec 2022 20:26:52 +1300 Subject: Allow parent's WaitEventSets to be freed after fork(). An epoll fd belonging to the parent should be closed in the child. A kqueue fd is automatically closed by fork(), but we should still adjust our counter. For poll and Windows systems, nothing special is required. On all systems we free the memory. No caller yet, but we'll need this if we start using WaitEventSet in the postmaster as planned. Reviewed-by: Andres Freund Discussion: https://postgr.es/m/CA%2BhUKG%2BZ-HpOj1JsO9eWUP%2Bar7npSVinsC_npxSy%2BjdOMsx%3DGg%40mail.gmail.com --- src/include/storage/latch.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/include') diff --git a/src/include/storage/latch.h b/src/include/storage/latch.h index c55838db607..63a1fc440c4 100644 --- a/src/include/storage/latch.h +++ b/src/include/storage/latch.h @@ -175,6 +175,7 @@ extern void ShutdownLatchSupport(void); extern WaitEventSet *CreateWaitEventSet(MemoryContext context, int nevents); extern void FreeWaitEventSet(WaitEventSet *set); +extern void FreeWaitEventSetAfterFork(WaitEventSet *set); extern int AddWaitEventToSet(WaitEventSet *set, uint32 events, pgsocket fd, Latch *latch, void *user_data); extern void ModifyWaitEvent(WaitEventSet *set, int pos, uint32 events, Latch *latch); -- cgit v1.2.3