Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 7324b2e

Browse files
author
Commitfest Bot
committed
[CF 5736] v1 - Fix a race condition in ConditionVariableTimedSleep()
This branch was automatically generated by a robot using patches from an email thread registered at: https://commitfest.postgresql.org/patch/5736 The branch will be overwritten each time a new patch version is posted to the thread, and also periodically to check for bitrot caused by changes on the master branch. Patch(es): https://www.postgresql.org/message-id/aBhuTqNhMN3prcqe@ip-10-97-1-34.eu-west-3.compute.internal Author(s): Bertrand Drouvot
2 parents 11b2dc3 + 9a4f49e commit 7324b2e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/backend/storage/lmgr/condition_variable.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ ConditionVariableTimedSleep(ConditionVariable *cv, long timeout,
184184
if (!proclist_contains(&cv->wakeup, MyProcNumber, cvWaitLink))
185185
{
186186
done = true;
187+
if (cv_sleep_target == NULL)
188+
cv_sleep_target = cv;
187189
proclist_push_tail(&cv->wakeup, MyProcNumber, cvWaitLink);
188190
}
189191
SpinLockRelease(&cv->mutex);

0 commit comments

Comments
 (0)