@@ -383,7 +383,7 @@ InitProcess(void)
383
383
* initialized by InitProcGlobal.
384
384
*/
385
385
SHMQueueElemInit (& (MyProc -> links ));
386
- MyProc -> waitStatus = STATUS_OK ;
386
+ MyProc -> waitStatus = PROC_WAIT_STATUS_OK ;
387
387
MyProc -> lxid = InvalidLocalTransactionId ;
388
388
MyProc -> fpVXIDLock = false;
389
389
MyProc -> fpLocalTransactionId = InvalidLocalTransactionId ;
@@ -567,7 +567,7 @@ InitAuxiliaryProcess(void)
567
567
* initialized by InitProcGlobal.
568
568
*/
569
569
SHMQueueElemInit (& (MyProc -> links ));
570
- MyProc -> waitStatus = STATUS_OK ;
570
+ MyProc -> waitStatus = PROC_WAIT_STATUS_OK ;
571
571
MyProc -> lxid = InvalidLocalTransactionId ;
572
572
MyProc -> fpVXIDLock = false;
573
573
MyProc -> fpLocalTransactionId = InvalidLocalTransactionId ;
@@ -755,7 +755,7 @@ LockErrorCleanup(void)
755
755
* did grant us the lock, we'd better remember it in our local lock
756
756
* table.
757
757
*/
758
- if (MyProc -> waitStatus == STATUS_OK )
758
+ if (MyProc -> waitStatus == PROC_WAIT_STATUS_OK )
759
759
GrantAwaitedLock ();
760
760
}
761
761
@@ -1051,14 +1051,14 @@ ProcQueueInit(PROC_QUEUE *queue)
1051
1051
* The lock table's partition lock must be held at entry, and will be held
1052
1052
* at exit.
1053
1053
*
1054
- * Result: STATUS_OK if we acquired the lock, STATUS_ERROR if not (deadlock).
1054
+ * Result: PROC_WAIT_STATUS_OK if we acquired the lock, PROC_WAIT_STATUS_ERROR if not (deadlock).
1055
1055
*
1056
1056
* ASSUME: that no one will fiddle with the queue until after
1057
1057
* we release the partition lock.
1058
1058
*
1059
1059
* NOTES: The process queue is now a priority queue for locking.
1060
1060
*/
1061
- int
1061
+ ProcWaitStatus
1062
1062
ProcSleep (LOCALLOCK * locallock , LockMethod lockMethodTable )
1063
1063
{
1064
1064
LOCKMODE lockmode = locallock -> tag .mode ;
@@ -1070,7 +1070,7 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable)
1070
1070
LOCKMASK myHeldLocks = MyProc -> heldLocks ;
1071
1071
bool early_deadlock = false;
1072
1072
bool allow_autovacuum_cancel = true;
1073
- int myWaitStatus ;
1073
+ ProcWaitStatus myWaitStatus ;
1074
1074
PGPROC * proc ;
1075
1075
PGPROC * leader = MyProc -> lockGroupLeader ;
1076
1076
int i ;
@@ -1161,7 +1161,7 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable)
1161
1161
/* Skip the wait and just grant myself the lock. */
1162
1162
GrantLock (lock , proclock , lockmode );
1163
1163
GrantAwaitedLock ();
1164
- return STATUS_OK ;
1164
+ return PROC_WAIT_STATUS_OK ;
1165
1165
}
1166
1166
/* Break out of loop to put myself before him */
1167
1167
break ;
@@ -1195,7 +1195,7 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable)
1195
1195
MyProc -> waitProcLock = proclock ;
1196
1196
MyProc -> waitLockMode = lockmode ;
1197
1197
1198
- MyProc -> waitStatus = STATUS_WAITING ;
1198
+ MyProc -> waitStatus = PROC_WAIT_STATUS_WAITING ;
1199
1199
1200
1200
/*
1201
1201
* If we detected deadlock, give up without waiting. This must agree with
@@ -1204,7 +1204,7 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable)
1204
1204
if (early_deadlock )
1205
1205
{
1206
1206
RemoveFromWaitQueue (MyProc , hashcode );
1207
- return STATUS_ERROR ;
1207
+ return PROC_WAIT_STATUS_ERROR ;
1208
1208
}
1209
1209
1210
1210
/* mark that we are waiting for a lock */
@@ -1236,7 +1236,7 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable)
1236
1236
/*
1237
1237
* Set timer so we can wake up after awhile and check for a deadlock. If a
1238
1238
* deadlock is detected, the handler sets MyProc->waitStatus =
1239
- * STATUS_ERROR , allowing us to know that we must report failure rather
1239
+ * PROC_WAIT_STATUS_ERROR , allowing us to know that we must report failure rather
1240
1240
* than success.
1241
1241
*
1242
1242
* By delaying the check until we've waited for a bit, we can avoid
@@ -1302,11 +1302,11 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable)
1302
1302
}
1303
1303
1304
1304
/*
1305
- * waitStatus could change from STATUS_WAITING to something else
1305
+ * waitStatus could change from PROC_WAIT_STATUS_WAITING to something else
1306
1306
* asynchronously. Read it just once per loop to prevent surprising
1307
1307
* behavior (such as missing log messages).
1308
1308
*/
1309
- myWaitStatus = * ((volatile int * ) & MyProc -> waitStatus );
1309
+ myWaitStatus = * ((volatile ProcWaitStatus * ) & MyProc -> waitStatus );
1310
1310
1311
1311
/*
1312
1312
* If we are not deadlocked, but are waiting on an autovacuum-induced
@@ -1487,24 +1487,24 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable)
1487
1487
lockHoldersNum , lock_holders_sbuf .data , lock_waiters_sbuf .data ))));
1488
1488
}
1489
1489
1490
- if (myWaitStatus == STATUS_WAITING )
1490
+ if (myWaitStatus == PROC_WAIT_STATUS_WAITING )
1491
1491
ereport (LOG ,
1492
1492
(errmsg ("process %d still waiting for %s on %s after %ld.%03d ms" ,
1493
1493
MyProcPid , modename , buf .data , msecs , usecs ),
1494
1494
(errdetail_log_plural ("Process holding the lock: %s. Wait queue: %s." ,
1495
1495
"Processes holding the lock: %s. Wait queue: %s." ,
1496
1496
lockHoldersNum , lock_holders_sbuf .data , lock_waiters_sbuf .data ))));
1497
- else if (myWaitStatus == STATUS_OK )
1497
+ else if (myWaitStatus == PROC_WAIT_STATUS_OK )
1498
1498
ereport (LOG ,
1499
1499
(errmsg ("process %d acquired %s on %s after %ld.%03d ms" ,
1500
1500
MyProcPid , modename , buf .data , msecs , usecs )));
1501
1501
else
1502
1502
{
1503
- Assert (myWaitStatus == STATUS_ERROR );
1503
+ Assert (myWaitStatus == PROC_WAIT_STATUS_ERROR );
1504
1504
1505
1505
/*
1506
1506
* Currently, the deadlock checker always kicks its own
1507
- * process, which means that we'll only see STATUS_ERROR when
1507
+ * process, which means that we'll only see PROC_WAIT_STATUS_ERROR when
1508
1508
* deadlock_state == DS_HARD_DEADLOCK, and there's no need to
1509
1509
* print redundant messages. But for completeness and
1510
1510
* future-proofing, print a message if it looks like someone
@@ -1529,7 +1529,7 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable)
1529
1529
pfree (lock_holders_sbuf .data );
1530
1530
pfree (lock_waiters_sbuf .data );
1531
1531
}
1532
- } while (myWaitStatus == STATUS_WAITING );
1532
+ } while (myWaitStatus == PROC_WAIT_STATUS_WAITING );
1533
1533
1534
1534
/*
1535
1535
* Disable the timers, if they are still running. As in LockErrorCleanup,
@@ -1568,7 +1568,7 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable)
1568
1568
/*
1569
1569
* If we got the lock, be sure to remember it in the locallock table.
1570
1570
*/
1571
- if (MyProc -> waitStatus == STATUS_OK )
1571
+ if (MyProc -> waitStatus == PROC_WAIT_STATUS_OK )
1572
1572
GrantAwaitedLock ();
1573
1573
1574
1574
/*
@@ -1590,18 +1590,18 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable)
1590
1590
* XXX: presently, this code is only used for the "success" case, and only
1591
1591
* works correctly for that case. To clean up in failure case, would need
1592
1592
* to twiddle the lock's request counts too --- see RemoveFromWaitQueue.
1593
- * Hence, in practice the waitStatus parameter must be STATUS_OK .
1593
+ * Hence, in practice the waitStatus parameter must be PROC_WAIT_STATUS_OK .
1594
1594
*/
1595
1595
PGPROC *
1596
- ProcWakeup (PGPROC * proc , int waitStatus )
1596
+ ProcWakeup (PGPROC * proc , ProcWaitStatus waitStatus )
1597
1597
{
1598
1598
PGPROC * retProc ;
1599
1599
1600
1600
/* Proc should be sleeping ... */
1601
1601
if (proc -> links .prev == NULL ||
1602
1602
proc -> links .next == NULL )
1603
1603
return NULL ;
1604
- Assert (proc -> waitStatus == STATUS_WAITING );
1604
+ Assert (proc -> waitStatus == PROC_WAIT_STATUS_WAITING );
1605
1605
1606
1606
/* Save next process before we zap the list link */
1607
1607
retProc = (PGPROC * ) proc -> links .next ;
@@ -1657,7 +1657,7 @@ ProcLockWakeup(LockMethod lockMethodTable, LOCK *lock)
1657
1657
{
1658
1658
/* OK to waken */
1659
1659
GrantLock (lock , proc -> waitProcLock , lockmode );
1660
- proc = ProcWakeup (proc , STATUS_OK );
1660
+ proc = ProcWakeup (proc , PROC_WAIT_STATUS_OK );
1661
1661
1662
1662
/*
1663
1663
* ProcWakeup removes proc from the lock's waiting process queue
@@ -1737,7 +1737,7 @@ CheckDeadLock(void)
1737
1737
* preserve the flexibility to kill some other transaction than the
1738
1738
* one detecting the deadlock.)
1739
1739
*
1740
- * RemoveFromWaitQueue sets MyProc->waitStatus to STATUS_ERROR , so
1740
+ * RemoveFromWaitQueue sets MyProc->waitStatus to PROC_WAIT_STATUS_ERROR , so
1741
1741
* ProcSleep will report an error after we return from the signal
1742
1742
* handler.
1743
1743
*/
0 commit comments