aboutsummaryrefslogtreecommitdiff
path: root/src/backend/storage/lmgr/condition_variable.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/storage/lmgr/condition_variable.c')
-rw-r--r--src/backend/storage/lmgr/condition_variable.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/backend/storage/lmgr/condition_variable.c b/src/backend/storage/lmgr/condition_variable.c
index 7e2bbf46d9d..910a768206f 100644
--- a/src/backend/storage/lmgr/condition_variable.c
+++ b/src/backend/storage/lmgr/condition_variable.c
@@ -223,15 +223,17 @@ ConditionVariableTimedSleep(ConditionVariable *cv, long timeout,
*
* Do nothing if nothing is pending; this allows this function to be called
* during transaction abort to clean up any unfinished CV sleep.
+ *
+ * Return true if we've been signaled.
*/
-void
+bool
ConditionVariableCancelSleep(void)
{
ConditionVariable *cv = cv_sleep_target;
bool signaled = false;
if (cv == NULL)
- return;
+ return false;
SpinLockAcquire(&cv->mutex);
if (proclist_contains(&cv->wakeup, MyProc->pgprocno, cvWaitLink))
@@ -240,15 +242,9 @@ ConditionVariableCancelSleep(void)
signaled = true;
SpinLockRelease(&cv->mutex);
- /*
- * If we've received a signal, pass it on to another waiting process, if
- * there is one. Otherwise a call to ConditionVariableSignal() might get
- * lost, despite there being another process ready to handle it.
- */
- if (signaled)
- ConditionVariableSignal(cv);
-
cv_sleep_target = NULL;
+
+ return signaled;
}
/*