Header And Logo

PostgreSQL
| The world's most advanced open source database.

Functions

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

void SHMQueueDelete ( SHM_QUEUE queue  ) 
void SHMQueueElemInit ( SHM_QUEUE queue  ) 
bool SHMQueueEmpty ( const SHM_QUEUE queue  ) 
void SHMQueueInit ( SHM_QUEUE queue  ) 
void SHMQueueInsertAfter ( SHM_QUEUE queue,
SHM_QUEUE elem 
)

Definition at line 108 of file shmqueue.c.

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

Referenced by SyncRepQueueInsert().

{
    SHM_QUEUE  *nextPtr = queue->next;

    Assert(ShmemAddrIsValid(queue));
    Assert(ShmemAddrIsValid(elem));

    elem->prev = nextPtr->prev;
    elem->next = queue->next;
    queue->next = elem;
    nextPtr->prev = elem;
}

void SHMQueueInsertBefore ( SHM_QUEUE queue,
SHM_QUEUE elem 
)
bool SHMQueueIsDetached ( const SHM_QUEUE queue  ) 

Definition at line 47 of file shmqueue.c.

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

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

{
    Assert(ShmemAddrIsValid(queue));
    return (queue->prev == NULL);
}

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

Definition at line 164 of file shmqueue.c.

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

Referenced by SyncRepQueueInsert().

{
    SHM_QUEUE  *elemPtr = curElem->prev;

    Assert(ShmemAddrIsValid(curElem));

    if (elemPtr == queue)       /* back to the queue head? */
        return NULL;

    return (Pointer) (((char *) elemPtr) - linkOffset);
}