Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3f3d60d

Browse files
committed
Fix race condition in ConditionVariablePrepareToSleep.
Thomas Munro
1 parentfc8219d commit3f3d60d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

‎src/backend/storage/lmgr/condition_variable.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,17 @@ ConditionVariablePrepareToSleep(ConditionVariable *cv)
7171
&MyProc->procLatch,NULL);
7272
}
7373

74+
/*
75+
* Reset my latch before adding myself to the queue and before entering
76+
* the caller's predicate loop.
77+
*/
78+
ResetLatch(&MyProc->procLatch);
79+
7480
/* Add myself to the wait queue. */
7581
SpinLockAcquire(&cv->mutex);
7682
if (!proclist_contains(&cv->wakeup,pgprocno,cvWaitLink))
7783
proclist_push_tail(&cv->wakeup,pgprocno,cvWaitLink);
7884
SpinLockRelease(&cv->mutex);
79-
80-
/* Reset my latch before entering the caller's predicate loop. */
81-
ResetLatch(&MyProc->procLatch);
8285
}
8386

8487
/*--------------------------------------------------------------------------

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp