Skip to content

Commit a7e65dc

Browse files
committed
Fix WaitLatch(NULL) on Windows.
Further to commit 733fa9a, on Windows when a latch is triggered but we aren't currently waiting for it, we need to locate the latch's HANDLE rather than calling ResetEvent(NULL). Author: Kyotaro Horiguchi <horikyota.ntt@gmail.com> Reported-by: Ranier Vilela <ranier.vf@gmail.com> Discussion: https://postgr.es/m/CAEudQArTPi1YBc%2Bn1fo0Asy3QBFhVjp_QgyKG-8yksVn%2ByRTiw%40mail.gmail.com
1 parent 805b816 commit a7e65dc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/backend/storage/ipc/latch.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1835,7 +1835,11 @@ WaitEventSetWaitBlock(WaitEventSet *set, int cur_timeout,
18351835

18361836
if (cur_event->events == WL_LATCH_SET)
18371837
{
1838-
if (!ResetEvent(set->latch->event))
1838+
/*
1839+
* We cannot use set->latch->event to reset the fired event if we
1840+
* aren't waiting on this latch now.
1841+
*/
1842+
if (!ResetEvent(set->handles[cur_event->pos + 1]))
18391843
elog(ERROR, "ResetEvent failed: error code %lu", GetLastError());
18401844

18411845
if (set->latch && set->latch->is_set)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy