Commit d2ce38e2 authored by Robert Haas's avatar Robert Haas

Rename WAIT_* constants to PG_WAIT_*.

Windows apparently has a constant named WAIT_TIMEOUT, and some of these
other names are pretty generic, too.  Insert "PG_" at the front of each
name in order to disambiguate.

Michael Paquier
parent eda04886
...@@ -497,7 +497,7 @@ pgfdw_get_result(PGconn *conn, const char *query) ...@@ -497,7 +497,7 @@ pgfdw_get_result(PGconn *conn, const char *query)
wc = WaitLatchOrSocket(MyLatch, wc = WaitLatchOrSocket(MyLatch,
WL_LATCH_SET | WL_SOCKET_READABLE, WL_LATCH_SET | WL_SOCKET_READABLE,
PQsocket(conn), PQsocket(conn),
-1L, WAIT_EXTENSION); -1L, PG_WAIT_EXTENSION);
ResetLatch(MyLatch); ResetLatch(MyLatch);
CHECK_FOR_INTERRUPTS(); CHECK_FOR_INTERRUPTS();
......
...@@ -3147,31 +3147,31 @@ pgstat_get_wait_event_type(uint32 wait_event_info) ...@@ -3147,31 +3147,31 @@ pgstat_get_wait_event_type(uint32 wait_event_info)
switch (classId) switch (classId)
{ {
case WAIT_LWLOCK_NAMED: case PG_WAIT_LWLOCK_NAMED:
event_type = "LWLockNamed"; event_type = "LWLockNamed";
break; break;
case WAIT_LWLOCK_TRANCHE: case PG_WAIT_LWLOCK_TRANCHE:
event_type = "LWLockTranche"; event_type = "LWLockTranche";
break; break;
case WAIT_LOCK: case PG_WAIT_LOCK:
event_type = "Lock"; event_type = "Lock";
break; break;
case WAIT_BUFFER_PIN: case PG_WAIT_BUFFER_PIN:
event_type = "BufferPin"; event_type = "BufferPin";
break; break;
case WAIT_ACTIVITY: case PG_WAIT_ACTIVITY:
event_type = "Activity"; event_type = "Activity";
break; break;
case WAIT_CLIENT: case PG_WAIT_CLIENT:
event_type = "Client"; event_type = "Client";
break; break;
case WAIT_EXTENSION: case PG_WAIT_EXTENSION:
event_type = "Extension"; event_type = "Extension";
break; break;
case WAIT_IPC: case PG_WAIT_IPC:
event_type = "IPC"; event_type = "IPC";
break; break;
case WAIT_TIMEOUT: case PG_WAIT_TIMEOUT:
event_type = "Timeout"; event_type = "Timeout";
break; break;
default: default:
...@@ -3204,41 +3204,41 @@ pgstat_get_wait_event(uint32 wait_event_info) ...@@ -3204,41 +3204,41 @@ pgstat_get_wait_event(uint32 wait_event_info)
switch (classId) switch (classId)
{ {
case WAIT_LWLOCK_NAMED: case PG_WAIT_LWLOCK_NAMED:
case WAIT_LWLOCK_TRANCHE: case PG_WAIT_LWLOCK_TRANCHE:
event_name = GetLWLockIdentifier(classId, eventId); event_name = GetLWLockIdentifier(classId, eventId);
break; break;
case WAIT_LOCK: case PG_WAIT_LOCK:
event_name = GetLockNameFromTagType(eventId); event_name = GetLockNameFromTagType(eventId);
break; break;
case WAIT_BUFFER_PIN: case PG_WAIT_BUFFER_PIN:
event_name = "BufferPin"; event_name = "BufferPin";
break; break;
case WAIT_ACTIVITY: case PG_WAIT_ACTIVITY:
{ {
WaitEventActivity w = (WaitEventActivity) wait_event_info; WaitEventActivity w = (WaitEventActivity) wait_event_info;
event_name = pgstat_get_wait_activity(w); event_name = pgstat_get_wait_activity(w);
break; break;
} }
case WAIT_CLIENT: case PG_WAIT_CLIENT:
{ {
WaitEventClient w = (WaitEventClient) wait_event_info; WaitEventClient w = (WaitEventClient) wait_event_info;
event_name = pgstat_get_wait_client(w); event_name = pgstat_get_wait_client(w);
break; break;
} }
case WAIT_EXTENSION: case PG_WAIT_EXTENSION:
event_name = "Extension"; event_name = "Extension";
break; break;
case WAIT_IPC: case PG_WAIT_IPC:
{ {
WaitEventIPC w = (WaitEventIPC) wait_event_info; WaitEventIPC w = (WaitEventIPC) wait_event_info;
event_name = pgstat_get_wait_ipc(w); event_name = pgstat_get_wait_ipc(w);
break; break;
} }
case WAIT_TIMEOUT: case PG_WAIT_TIMEOUT:
{ {
WaitEventTimeout w = (WaitEventTimeout) wait_event_info; WaitEventTimeout w = (WaitEventTimeout) wait_event_info;
......
...@@ -3646,7 +3646,7 @@ LockBufferForCleanup(Buffer buffer) ...@@ -3646,7 +3646,7 @@ LockBufferForCleanup(Buffer buffer)
SetStartupBufferPinWaitBufId(-1); SetStartupBufferPinWaitBufId(-1);
} }
else else
ProcWaitForSignal(WAIT_BUFFER_PIN); ProcWaitForSignal(PG_WAIT_BUFFER_PIN);
/* /*
* Remove flag marking us as waiter. Normally this will not be set * Remove flag marking us as waiter. Normally this will not be set
......
...@@ -390,7 +390,7 @@ ResolveRecoveryConflictWithLock(LOCKTAG locktag) ...@@ -390,7 +390,7 @@ ResolveRecoveryConflictWithLock(LOCKTAG locktag)
} }
/* Wait to be signaled by the release of the Relation Lock */ /* Wait to be signaled by the release of the Relation Lock */
ProcWaitForSignal(WAIT_LOCK | locktag.locktag_type); ProcWaitForSignal(PG_WAIT_LOCK | locktag.locktag_type);
/* /*
* Clear any timeout requests established above. We assume here that the * Clear any timeout requests established above. We assume here that the
...@@ -470,7 +470,7 @@ ResolveRecoveryConflictWithBufferPin(void) ...@@ -470,7 +470,7 @@ ResolveRecoveryConflictWithBufferPin(void)
} }
/* Wait to be signaled by UnpinBuffer() */ /* Wait to be signaled by UnpinBuffer() */
ProcWaitForSignal(WAIT_BUFFER_PIN); ProcWaitForSignal(PG_WAIT_BUFFER_PIN);
/* /*
* Clear any timeout requests established above. We assume here that the * Clear any timeout requests established above. We assume here that the
......
...@@ -732,9 +732,9 @@ LWLockReportWaitStart(LWLock *lock) ...@@ -732,9 +732,9 @@ LWLockReportWaitStart(LWLock *lock)
int lockId = T_ID(lock); int lockId = T_ID(lock);
if (lock->tranche == 0) if (lock->tranche == 0)
pgstat_report_wait_start(WAIT_LWLOCK_NAMED | (uint16) lockId); pgstat_report_wait_start(PG_WAIT_LWLOCK_NAMED | (uint16) lockId);
else else
pgstat_report_wait_start(WAIT_LWLOCK_TRANCHE | lock->tranche); pgstat_report_wait_start(PG_WAIT_LWLOCK_TRANCHE | lock->tranche);
} }
/* /*
...@@ -752,10 +752,10 @@ LWLockReportWaitEnd(void) ...@@ -752,10 +752,10 @@ LWLockReportWaitEnd(void)
const char * const char *
GetLWLockIdentifier(uint32 classId, uint16 eventId) GetLWLockIdentifier(uint32 classId, uint16 eventId)
{ {
if (classId == WAIT_LWLOCK_NAMED) if (classId == PG_WAIT_LWLOCK_NAMED)
return MainLWLockNames[eventId]; return MainLWLockNames[eventId];
Assert(classId == WAIT_LWLOCK_TRANCHE); Assert(classId == PG_WAIT_LWLOCK_TRANCHE);
/* /*
* It is quite possible that user has registered tranche in one of the * It is quite possible that user has registered tranche in one of the
......
...@@ -1214,7 +1214,7 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable) ...@@ -1214,7 +1214,7 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable)
else else
{ {
WaitLatch(MyLatch, WL_LATCH_SET, 0, WaitLatch(MyLatch, WL_LATCH_SET, 0,
WAIT_LOCK | locallock->tag.lock.locktag_type); PG_WAIT_LOCK | locallock->tag.lock.locktag_type);
ResetLatch(MyLatch); ResetLatch(MyLatch);
/* check for deadlocks first, as that's probably log-worthy */ /* check for deadlocks first, as that's probably log-worthy */
if (got_deadlock_timeout) if (got_deadlock_timeout)
......
...@@ -715,15 +715,15 @@ typedef enum BackendState ...@@ -715,15 +715,15 @@ typedef enum BackendState
* Wait Classes * Wait Classes
* ---------- * ----------
*/ */
#define WAIT_LWLOCK_NAMED 0x01000000U #define PG_WAIT_LWLOCK_NAMED 0x01000000U
#define WAIT_LWLOCK_TRANCHE 0x02000000U #define PG_WAIT_LWLOCK_TRANCHE 0x02000000U
#define WAIT_LOCK 0x03000000U #define PG_WAIT_LOCK 0x03000000U
#define WAIT_BUFFER_PIN 0x04000000U #define PG_WAIT_BUFFER_PIN 0x04000000U
#define WAIT_ACTIVITY 0x05000000U #define PG_WAIT_ACTIVITY 0x05000000U
#define WAIT_CLIENT 0x06000000U #define PG_WAIT_CLIENT 0x06000000U
#define WAIT_EXTENSION 0x07000000U #define PG_WAIT_EXTENSION 0x07000000U
#define WAIT_IPC 0x08000000U #define PG_WAIT_IPC 0x08000000U
#define WAIT_TIMEOUT 0x09000000U #define PG_WAIT_TIMEOUT 0x09000000U
/* ---------- /* ----------
* Wait Events - Activity * Wait Events - Activity
...@@ -735,7 +735,7 @@ typedef enum BackendState ...@@ -735,7 +735,7 @@ typedef enum BackendState
*/ */
typedef enum typedef enum
{ {
WAIT_EVENT_ARCHIVER_MAIN = WAIT_ACTIVITY, WAIT_EVENT_ARCHIVER_MAIN = PG_WAIT_ACTIVITY,
WAIT_EVENT_AUTOVACUUM_MAIN, WAIT_EVENT_AUTOVACUUM_MAIN,
WAIT_EVENT_BGWRITER_HIBERNATE, WAIT_EVENT_BGWRITER_HIBERNATE,
WAIT_EVENT_BGWRITER_MAIN, WAIT_EVENT_BGWRITER_MAIN,
...@@ -759,7 +759,7 @@ typedef enum ...@@ -759,7 +759,7 @@ typedef enum
*/ */
typedef enum typedef enum
{ {
WAIT_EVENT_CLIENT_READ = WAIT_CLIENT, WAIT_EVENT_CLIENT_READ = PG_WAIT_CLIENT,
WAIT_EVENT_CLIENT_WRITE, WAIT_EVENT_CLIENT_WRITE,
WAIT_EVENT_SSL_OPEN_SERVER, WAIT_EVENT_SSL_OPEN_SERVER,
WAIT_EVENT_WAL_RECEIVER_WAIT_START, WAIT_EVENT_WAL_RECEIVER_WAIT_START,
...@@ -776,7 +776,7 @@ typedef enum ...@@ -776,7 +776,7 @@ typedef enum
*/ */
typedef enum typedef enum
{ {
WAIT_EVENT_BGWORKER_SHUTDOWN = WAIT_IPC, WAIT_EVENT_BGWORKER_SHUTDOWN = PG_WAIT_IPC,
WAIT_EVENT_BGWORKER_STARTUP, WAIT_EVENT_BGWORKER_STARTUP,
WAIT_EVENT_EXECUTE_GATHER, WAIT_EVENT_EXECUTE_GATHER,
WAIT_EVENT_MQ_INTERNAL, WAIT_EVENT_MQ_INTERNAL,
...@@ -796,7 +796,7 @@ typedef enum ...@@ -796,7 +796,7 @@ typedef enum
*/ */
typedef enum typedef enum
{ {
WAIT_EVENT_BASE_BACKUP_THROTTLE = WAIT_TIMEOUT, WAIT_EVENT_BASE_BACKUP_THROTTLE = PG_WAIT_TIMEOUT,
WAIT_EVENT_PG_SLEEP, WAIT_EVENT_PG_SLEEP,
WAIT_EVENT_RECOVERY_APPLY_DELAY WAIT_EVENT_RECOVERY_APPLY_DELAY
} WaitEventTimeout; } WaitEventTimeout;
......
...@@ -280,7 +280,7 @@ wait_for_workers_to_become_ready(worker_state *wstate, ...@@ -280,7 +280,7 @@ wait_for_workers_to_become_ready(worker_state *wstate,
} }
/* Wait to be signalled. */ /* Wait to be signalled. */
WaitLatch(MyLatch, WL_LATCH_SET, 0, WAIT_EXTENSION); WaitLatch(MyLatch, WL_LATCH_SET, 0, PG_WAIT_EXTENSION);
/* Reset the latch so we don't spin. */ /* Reset the latch so we don't spin. */
ResetLatch(MyLatch); ResetLatch(MyLatch);
......
...@@ -231,7 +231,7 @@ test_shm_mq_pipelined(PG_FUNCTION_ARGS) ...@@ -231,7 +231,7 @@ test_shm_mq_pipelined(PG_FUNCTION_ARGS)
* have read or written data and therefore there may now be work * have read or written data and therefore there may now be work
* for us to do. * for us to do.
*/ */
WaitLatch(MyLatch, WL_LATCH_SET, 0, WAIT_EXTENSION); WaitLatch(MyLatch, WL_LATCH_SET, 0, PG_WAIT_EXTENSION);
ResetLatch(MyLatch); ResetLatch(MyLatch);
CHECK_FOR_INTERRUPTS(); CHECK_FOR_INTERRUPTS();
} }
......
...@@ -228,7 +228,7 @@ worker_spi_main(Datum main_arg) ...@@ -228,7 +228,7 @@ worker_spi_main(Datum main_arg)
rc = WaitLatch(MyLatch, rc = WaitLatch(MyLatch,
WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH, WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH,
worker_spi_naptime * 1000L, worker_spi_naptime * 1000L,
WAIT_EXTENSION); PG_WAIT_EXTENSION);
ResetLatch(MyLatch); ResetLatch(MyLatch);
/* emergency bailout if postmaster has died */ /* emergency bailout if postmaster has died */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment