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

Commitf5a5773

Browse files
committed
Allow condition variables to be used in interrupt code.
Adjust the condition variable sleep loop to work correctly when codereached by its internal CHECK_FOR_INTERRUPTS() call interacts withanother condition variable.There are no such cases currently, but a proposed patch would do this.Discussion:https://postgr.es/m/CA+hUKGLdemy2gBm80kz20GTe6hNVwoErE8KwcJk6-U56oStjtg@mail.gmail.com
1 parent814f1d8 commitf5a5773

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,6 @@ ConditionVariableTimedSleep(ConditionVariable *cv, long timeout,
165165
/* Reset latch before examining the state of the wait list. */
166166
ResetLatch(MyLatch);
167167

168-
CHECK_FOR_INTERRUPTS();
169-
170168
/*
171169
* If this process has been taken out of the wait list, then we know
172170
* that it has been signaled by ConditionVariableSignal (or
@@ -190,6 +188,15 @@ ConditionVariableTimedSleep(ConditionVariable *cv, long timeout,
190188
}
191189
SpinLockRelease(&cv->mutex);
192190

191+
/*
192+
* Check for interrupts, and return spuriously if that caused the
193+
* current sleep target to change (meaning that interrupt handler code
194+
* waited for a different condition variable).
195+
*/
196+
CHECK_FOR_INTERRUPTS();
197+
if (cv!=cv_sleep_target)
198+
done= true;
199+
193200
/* We were signaled, so return */
194201
if (done)
195202
return false;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp