sphsinglepcqueue.h
Go to the documentation of this file.
/*
* Copyright (c) 2012-2015 IBM Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation, Steven Munroe - initial API and implementation
*/
#ifndef __SPH_SINGLE_PC_QUEUE_H
#define __SPH_SINGLE_PC_QUEUE_H
#include "sastype.h"
#include "sphlfentry.h"
typedef void *SPHSinglePCQueue_t;
#ifdef __cplusplus
#define __C__ "C"
#else
#define __C__
#endif
#if 0
typedef unsigned long longPtr_t;
#endif
#define SPHSPCQUEUE_CIRCULAR (1)
#define SPHSPCQUEUE_CIRCULAR_WRAPED (1<<1)
#define SPHSPCQUEUE_CIRCULAR_NOTFIRST (1<<2)
#define SPHSPCQUEUE_CACHE_PREFETCH0 (1<<3)
#define SPHSPCQUEUE_CACHE_PREFETCH1 (1<<4)
#define SPHSPCQUEUE_CIRCULAR_RESETMASK (SPHSPCQUEUE_CIRCULAR | \
SPHSPCQUEUE_CACHE_PREFETCH0 | \
SPHSPCQUEUE_CACHE_PREFETCH1)
extern __C__ SPHSinglePCQueue_t
SPHSinglePCQueueInit (void *buf_seg , block_size_t buf_size);
extern __C__ SPHSinglePCQueue_t
SPHSinglePCQueueInitWithStride (void* buf_seg, block_size_t buf_size,
unsigned short entry_stride,
unsigned int options);
extern __C__ SPHSinglePCQueue_t
SPHSinglePCQueueCreate (block_size_t buf_size);
extern __C__ SPHSinglePCQueue_t
SPHSinglePCQueueCreateWithStride (block_size_t buf_size,
unsigned short stride);
extern __C__ int
SPHSinglePCQueueGetStride (SPHSinglePCQueue_t queue);
extern __C__ void *
SPHSinglePCQueueAllocRaw (SPHSinglePCQueue_t queue);
extern __C__ SPHLFEntryHandle_t *
SPHSinglePCQueueAllocStrideEntry (SPHSinglePCQueue_t queue,
int catcode, int subcode,
SPHLFEntryHandle_t *handlespace);
extern __C__ SPHLFEntryHandle_t *
SPHSinglePCQueueAllocStrideTimeStamped (SPHSinglePCQueue_t queue,
int catcode, int subcode,
SPHLFEntryHandle_t *handlespace);
extern __C__ int
SPHSinglePCQueueEntryComplete (SPHLFEntryHandle_t *entryhandle);
extern __C__ int
SPHSinglePCQueueEntryIsComplete (SPHLFEntryHandle_t *entryhandle);
extern __C__ SPHLFEntryHandle_t*
SPHSinglePCQueueGetNextComplete (SPHSinglePCQueue_t queue,
SPHLFEntryHandle_t *handlespace);
extern __C__ int
SPHSinglePCQueueFreeNextEntry (SPHSinglePCQueue_t queue);
extern __C__ int
SPHSinglePCQueueEmpty (SPHSinglePCQueue_t queue);
extern __C__ block_size_t
SPHSinglePCQueueFreeSpace (SPHSinglePCQueue_t queue);
extern __C__ int
SPHSinglePCQueueFull (SPHSinglePCQueue_t queue);
extern __C__ int
SPHSinglePCQueueResetAsync (SPHSinglePCQueue_t queue);
extern __C__ int
SPHSinglePCQueuePrefetch (SPHSinglePCQueue_t queue);
extern __C__ int
SPHSinglePCQueueSetCachePrefetch (SPHSinglePCQueue_t queue, int prefetch);
extern __C__ int
SPHSinglePCQueueDestroy (SPHSinglePCQueue_t queue);
#endif /* __SPH_SINGLE_PC_QUEUE_H */
sphlfentry.h
Shared Persistent Heap, logger/queue etc event entry status, update, and access functions.
longPtr_t
unsigned long longPtr_t
unsigned int type, consistent with the size of a pointer and used for pointer calculations
Definition: sphlflogger.h:183
SPHSinglePCQueueCreateWithStride
__C__ SPHSinglePCQueue_t SPHSinglePCQueueCreateWithStride(block_size_t buf_size, unsigned short stride)
Allocate and initialize a shared storage block as a Lock Free Single Producer Single Consumer Queue.
SPHSinglePCQueueSetCachePrefetch
__C__ int SPHSinglePCQueueSetCachePrefetch(SPHSinglePCQueue_t queue, int prefetch)
Set the cache-line prefetch options for entry allocate.
SPHSinglePCQueueCreate
__C__ SPHSinglePCQueue_t SPHSinglePCQueueCreate(block_size_t buf_size)
Allocate and initialize a shared storage block as a Lock Free Single Producer Single Consumer Queue.
SPHSinglePCQueueGetNextComplete
__C__ SPHLFEntryHandle_t * SPHSinglePCQueueGetNextComplete(SPHSinglePCQueue_t queue, SPHLFEntryHandle_t *handlespace)
Allows the consumer to get the next completed queue entry from the specified single producer single c...
SPHSinglePCQueueAllocRaw
__C__ void * SPHSinglePCQueueAllocRaw(SPHSinglePCQueue_t queue)
Allows the Producer thread to return the address of a (raw) queue entry allocated from the specified ...
__C__
#define __C__
ignore this macro behind the curtain
Definition: sphsinglepcqueue.h:186
SPHSinglePCQueueFreeNextEntry
__C__ int SPHSinglePCQueueFreeNextEntry(SPHSinglePCQueue_t queue)
Allows the consumer to free the queue entry it just processed (using SPHSinglePCQueueGetNextComplete)...
SPHSinglePCQueueResetAsync
__C__ int SPHSinglePCQueueResetAsync(SPHSinglePCQueue_t queue)
Resets the specific queue to empty state asynchronously (without locking or atomic updates).
SPHSinglePCQueueInit
__C__ SPHSinglePCQueue_t SPHSinglePCQueueInit(void *buf_seg, block_size_t buf_size)
Initialize a shared storage block as a Lock Free PC Queue.
SPHSinglePCQueuePrefetch
__C__ int SPHSinglePCQueuePrefetch(SPHSinglePCQueue_t queue)
Prefetch pages from the specific queue.
SPHSinglePCQueueEmpty
__C__ int SPHSinglePCQueueEmpty(SPHSinglePCQueue_t queue)
Return the status of the specified queue.
SPHSinglePCQueueInitWithStride
__C__ SPHSinglePCQueue_t SPHSinglePCQueueInitWithStride(void *buf_seg, block_size_t buf_size, unsigned short entry_stride, unsigned int options)
Initialize a shared storage block as a Lock Free Single Producer Single Consumer Queue with a fixed e...
SPHSinglePCQueueFreeSpace
__C__ block_size_t SPHSinglePCQueueFreeSpace(SPHSinglePCQueue_t queue)
Returns the amount of free space (in bytes) remaining in the specified queue.
SPHSinglePCQueueAllocStrideTimeStamped
__C__ SPHLFEntryHandle_t * SPHSinglePCQueueAllocStrideTimeStamped(SPHSinglePCQueue_t queue, int catcode, int subcode, SPHLFEntryHandle_t *handlespace)
Allows the producer thread to allocate and initialize the header, of a queue entry for access....
SPHSinglePCQueueEntryIsComplete
__C__ int SPHSinglePCQueueEntryIsComplete(SPHLFEntryHandle_t *entryhandle)
Return the status of the entry specified by the entry handle.
SPHSinglePCQueueFull
__C__ int SPHSinglePCQueueFull(SPHSinglePCQueue_t queue)
Return the status of the specified queue.
SPHSinglePCQueueGetStride
__C__ int SPHSinglePCQueueGetStride(SPHSinglePCQueue_t queue)
Return the entry stride for an existing Lock Free Single Producer Single Consumer Queue.
SPHSinglePCQueueDestroy
__C__ int SPHSinglePCQueueDestroy(SPHSinglePCQueue_t queue)
Destroys the queue and frees the SAS storage for reuse.
SPHSinglePCQueueEntryComplete
__C__ int SPHSinglePCQueueEntryComplete(SPHLFEntryHandle_t *entryhandle)
Allows the producer thread to mark the queue entry, specified by the entry handle,...
SPHSinglePCQueue_t
void * SPHSinglePCQueue_t
Handle to an instance of SPH Lock Free Single Producer, Single Consumer Queue.
Definition: sphsinglepcqueue.h:180
SPHSinglePCQueueAllocStrideEntry
__C__ SPHLFEntryHandle_t * SPHSinglePCQueueAllocStrideEntry(SPHSinglePCQueue_t queue, int catcode, int subcode, SPHLFEntryHandle_t *handlespace)
Allows the producer thread to allocate and initialize the header of a queue entry for access....
SPHLFEntryHandle_t
Instance of a Lock Free event data Entry Handle.
Definition: sphlfentry.h:115