PostgreSQL Source Code  git master
shmqueue.c File Reference
#include "postgres.h"
#include "storage/shmem.h"
Include dependency graph for shmqueue.c:

Go to the source code of this file.

Functions

void SHMQueueInit (SHM_QUEUE *queue)
 
bool SHMQueueIsDetached (const SHM_QUEUE *queue)
 
void SHMQueueElemInit (SHM_QUEUE *queue)
 
void SHMQueueDelete (SHM_QUEUE *queue)
 
void SHMQueueInsertBefore (SHM_QUEUE *queue, SHM_QUEUE *elem)
 
void SHMQueueInsertAfter (SHM_QUEUE *queue, SHM_QUEUE *elem)
 
Pointer SHMQueueNext (const SHM_QUEUE *queue, const SHM_QUEUE *curElem, Size linkOffset)
 
Pointer SHMQueuePrev (const SHM_QUEUE *queue, const SHM_QUEUE *curElem, Size linkOffset)
 
bool SHMQueueEmpty (const SHM_QUEUE *queue)
 

Function Documentation

◆ SHMQueueDelete()

void SHMQueueDelete ( SHM_QUEUE queue)

Definition at line 68 of file shmqueue.c.

69 {
70  SHM_QUEUE *nextElem = queue->next;
71  SHM_QUEUE *prevElem = queue->prev;
72 
73  Assert(ShmemAddrIsValid(queue));
74  Assert(ShmemAddrIsValid(nextElem));
75  Assert(ShmemAddrIsValid(prevElem));
76 
77  prevElem->next = queue->next;
78  nextElem->prev = queue->prev;
79 
80  queue->prev = queue->next = NULL;
81 }
Assert(fmt[strlen(fmt) - 1] !='\n')
bool ShmemAddrIsValid(const void *addr)
Definition: shmem.c:283
struct SHM_QUEUE * next
Definition: shmem.h:31
struct SHM_QUEUE * prev
Definition: shmem.h:30

References Assert(), SHM_QUEUE::next, SHM_QUEUE::prev, and ShmemAddrIsValid().

Referenced by CheckTargetForConflictsIn(), CleanUpLock(), ClearOldPredicateLocks(), CreatePredXact(), DeleteChildTargetLocks(), DeleteLockTarget(), DropAllPredicateLocksFromTable(), LockAcquireExtended(), PostPrepare_Locks(), ProcWakeup(), ReleaseOneSerializableXact(), ReleasePredXact(), ReleaseRWConflict(), RemoveFromWaitQueue(), SetPossibleUnsafeConflict(), SetRWConflict(), SummarizeOldestCommittedSxact(), SyncRepCancelWait(), SyncRepCleanupAtProcExit(), SyncRepWakeQueue(), and TransferPredicateLocksToNewTarget().

◆ SHMQueueElemInit()

void SHMQueueElemInit ( SHM_QUEUE queue)

◆ SHMQueueEmpty()

bool SHMQueueEmpty ( const SHM_QUEUE queue)

◆ SHMQueueInit()

◆ SHMQueueInsertAfter()

void SHMQueueInsertAfter ( SHM_QUEUE queue,
SHM_QUEUE elem 
)

Definition at line 108 of file shmqueue.c.

109 {
110  SHM_QUEUE *nextPtr = queue->next;
111 
112  Assert(ShmemAddrIsValid(queue));
113  Assert(ShmemAddrIsValid(elem));
114 
115  elem->prev = nextPtr->prev;
116  elem->next = queue->next;
117  queue->next = elem;
118  nextPtr->prev = elem;
119 }

References Assert(), SHM_QUEUE::next, SHM_QUEUE::prev, and ShmemAddrIsValid().

Referenced by SyncRepQueueInsert().

◆ SHMQueueInsertBefore()

◆ SHMQueueIsDetached()

bool SHMQueueIsDetached ( const SHM_QUEUE queue)

Definition at line 47 of file shmqueue.c.

48 {
49  Assert(ShmemAddrIsValid(queue));
50  return (queue->prev == NULL);
51 }

References Assert(), SHM_QUEUE::prev, and ShmemAddrIsValid().

Referenced by SyncRepCancelWait(), SyncRepCleanupAtProcExit(), and SyncRepWaitForLSN().

◆ SHMQueueNext()

◆ SHMQueuePrev()

Pointer SHMQueuePrev ( const SHM_QUEUE queue,
const SHM_QUEUE curElem,
Size  linkOffset 
)

Definition at line 164 of file shmqueue.c.

165 {
166  SHM_QUEUE *elemPtr = curElem->prev;
167 
168  Assert(ShmemAddrIsValid(curElem));
169 
170  if (elemPtr == queue) /* back to the queue head? */
171  return NULL;
172 
173  return (Pointer) (((char *) elemPtr) - linkOffset);
174 }

References Assert(), SHM_QUEUE::prev, and ShmemAddrIsValid().

Referenced by SyncRepQueueInsert().