aboutsummaryrefslogtreecommitdiff
path: root/src/include/storage/proc.h
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2020-06-17 09:14:37 +0200
committerPeter Eisentraut <peter@eisentraut.org>2020-06-17 09:14:37 +0200
commita513f1dfbf2c29a51b0f7cbd5913ce2d2ee452c5 (patch)
treea0be32004adffe63ad9f45ab454b93bcccc060c6 /src/include/storage/proc.h
parent42aa1f0ab321fd43cbfdd875dd9e13940b485900 (diff)
downloadpostgresql-a513f1dfbf2c29a51b0f7cbd5913ce2d2ee452c5.tar.gz
postgresql-a513f1dfbf2c29a51b0f7cbd5913ce2d2ee452c5.zip
Remove STATUS_WAITING
Add a separate enum for use in the locking APIs, which were the only user. Discussion: https://www.postgresql.org/message-id/flat/a6f91ead-0ce4-2a34-062b-7ab9813ea308%402ndquadrant.com
Diffstat (limited to 'src/include/storage/proc.h')
-rw-r--r--src/include/storage/proc.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h
index 1ee9000b2b9..b20e2ad4f6a 100644
--- a/src/include/storage/proc.h
+++ b/src/include/storage/proc.h
@@ -76,6 +76,13 @@ struct XidCache
*/
#define INVALID_PGPROCNO PG_INT32_MAX
+typedef enum
+{
+ PROC_WAIT_STATUS_OK,
+ PROC_WAIT_STATUS_WAITING,
+ PROC_WAIT_STATUS_ERROR,
+} ProcWaitStatus;
+
/*
* Each backend has a PGPROC struct in shared memory. There is also a list of
* currently-unused PGPROC structs that will be reallocated to new backends.
@@ -99,7 +106,7 @@ struct PGPROC
PGPROC **procgloballist; /* procglobal list that owns this PGPROC */
PGSemaphore sem; /* ONE semaphore to sleep on */
- int waitStatus; /* STATUS_WAITING, STATUS_OK or STATUS_ERROR */
+ ProcWaitStatus waitStatus;
Latch procLatch; /* generic latch for process */
@@ -315,8 +322,8 @@ extern bool HaveNFreeProcs(int n);
extern void ProcReleaseLocks(bool isCommit);
extern void ProcQueueInit(PROC_QUEUE *queue);
-extern int ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable);
-extern PGPROC *ProcWakeup(PGPROC *proc, int waitStatus);
+extern ProcWaitStatus ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable);
+extern PGPROC *ProcWakeup(PGPROC *proc, ProcWaitStatus waitStatus);
extern void ProcLockWakeup(LockMethod lockMethodTable, LOCK *lock);
extern void CheckDeadLockAlert(void);
extern bool IsWaitingForLock(void);