From 566dfd994283822926a5a3231c92ee512d541a3c Mon Sep 17 00:00:00 2001
From: reshke <reshke@double.cloud>
Date: Tue, 19 Aug 2025 06:21:11 +0000
Subject: [PATCH v2 2/2] Add assertion for WaitEventSetWait in crit section

---
 src/backend/storage/ipc/waiteventset.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/backend/storage/ipc/waiteventset.c b/src/backend/storage/ipc/waiteventset.c
index 7c0e66900f9..e89e1d115cb 100644
--- a/src/backend/storage/ipc/waiteventset.c
+++ b/src/backend/storage/ipc/waiteventset.c
@@ -1044,6 +1044,7 @@ WaitEventSetWait(WaitEventSet *set, long timeout,
 	long		cur_timeout = -1;
 
 	Assert(nevents > 0);
+	Assert(CritSectionCount == 0);
 
 	/*
 	 * Initialize timeout if requested.  We must record the current time so
-- 
2.43.0

