Shared Persistent Heap Data Environment Manual  1.1.0
sphsinglepcqueue.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012-2015 IBM Corporation.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation, Steven Munroe - initial API and implementation
10  */
11 
12 #ifndef __SPH_SINGLE_PC_QUEUE_H
13 #define __SPH_SINGLE_PC_QUEUE_H
14 
171 #include "sastype.h"
172 #include "sphlfentry.h"
173 
174 
180 typedef void *SPHSinglePCQueue_t;
181 
183 #ifdef __cplusplus
184 #define __C__ "C"
185 #else
186 #define __C__
187 #endif
188 #if 0
189 
190 typedef unsigned long longPtr_t;
191 #endif
192 
193 #define SPHSPCQUEUE_CIRCULAR (1)
194 
195 #define SPHSPCQUEUE_CIRCULAR_WRAPED (1<<1)
196 
197 #define SPHSPCQUEUE_CIRCULAR_NOTFIRST (1<<2)
198 
199 #define SPHSPCQUEUE_CACHE_PREFETCH0 (1<<3)
200 
201 #define SPHSPCQUEUE_CACHE_PREFETCH1 (1<<4)
202 
203 #define SPHSPCQUEUE_CIRCULAR_RESETMASK (SPHSPCQUEUE_CIRCULAR | \
204  SPHSPCQUEUE_CACHE_PREFETCH0 | \
205  SPHSPCQUEUE_CACHE_PREFETCH1)
206 
220 SPHSinglePCQueueInit (void *buf_seg , block_size_t buf_size);
221 
240 SPHSinglePCQueueInitWithStride (void* buf_seg, block_size_t buf_size,
241  unsigned short entry_stride,
242  unsigned int options);
243 
255 SPHSinglePCQueueCreate (block_size_t buf_size);
256 
269 SPHSinglePCQueueCreateWithStride (block_size_t buf_size,
270  unsigned short stride);
271 
279 extern __C__ int
281 
298 extern __C__ void *
300 
326 extern __C__ SPHLFEntryHandle_t *
328  int catcode, int subcode,
329  SPHLFEntryHandle_t *handlespace);
330 
357 extern __C__ SPHLFEntryHandle_t *
359  int catcode, int subcode,
360  SPHLFEntryHandle_t *handlespace);
361 
377 extern __C__ int
379 
386 extern __C__ int
388 
407  SPHLFEntryHandle_t *handlespace);
408 
427 extern __C__ int
429 
436 extern __C__ int
438 
444 extern __C__ block_size_t
446 
453 extern __C__ int
455 
456 
464 extern __C__ int
466 
472 extern __C__ int
474 
486 extern __C__ int
488 
494 extern __C__ int
496 
497 #endif /* __SPH_SINGLE_PC_QUEUE_H */
__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...
__C__ int SPHSinglePCQueueFull(SPHSinglePCQueue_t queue)
Return the status of the specified queue.
__C__ SPHSinglePCQueue_t SPHSinglePCQueueInit(void *buf_seg, block_size_t buf_size)
Initialize a shared storage block as a Lock Free PC Queue.
__C__ void * SPHSinglePCQueueAllocRaw(SPHSinglePCQueue_t queue)
Allows the Producer thread to return the address of a (raw) queue entry allocated from the specified ...
Shared Persistent Heap, logger/queue etc event entry status, update, and access functions.
__C__ int SPHSinglePCQueueEntryComplete(SPHLFEntryHandle_t *entryhandle)
Allows the producer thread to mark the queue entry, specified by the entry handle, as complete. This makes the queue entry accessible to the consumer thread.
Instance of a Lock Free event data Entry Handle.
Definition: sphlfentry.h:115
__C__ int SPHSinglePCQueueGetStride(SPHSinglePCQueue_t queue)
Return the entry stride for an existing Lock Free Single Producer Single Consumer Queue...
__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...
__C__ int SPHSinglePCQueueDestroy(SPHSinglePCQueue_t queue)
Destroys the queue and frees the SAS storage for reuse.
unsigned long longPtr_t
unsigned int type, consistent with the size of a pointer and used for pointer calculations ...
Definition: sphlflogger.h:183
__C__ int SPHSinglePCQueueResetAsync(SPHSinglePCQueue_t queue)
Resets the specific queue to empty state asynchronously (without locking or atomic updates)...
__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...
__C__ block_size_t SPHSinglePCQueueFreeSpace(SPHSinglePCQueue_t queue)
Returns the amount of free space (in bytes) remaining in the specified queue.
__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...
__C__ int SPHSinglePCQueueEntryIsComplete(SPHLFEntryHandle_t *entryhandle)
Return the status of the entry specified by the entry handle.
__C__ int SPHSinglePCQueueFreeNextEntry(SPHSinglePCQueue_t queue)
Allows the consumer to free the queue entry it just processed (using SPHSinglePCQueueGetNextComplete)...
#define __C__
ignore this macro behind the curtain
Definition: sphsinglepcqueue.h:186
__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...
void * SPHSinglePCQueue_t
Handle to an instance of SPH Lock Free Single Producer, Single Consumer Queue.
Definition: sphsinglepcqueue.h:180
__C__ int SPHSinglePCQueueEmpty(SPHSinglePCQueue_t queue)
Return the status of the specified queue.
__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...
__C__ int SPHSinglePCQueueSetCachePrefetch(SPHSinglePCQueue_t queue, int prefetch)
Set the cache-line prefetch options for entry allocate.
__C__ int SPHSinglePCQueuePrefetch(SPHSinglePCQueue_t queue)
Prefetch pages from the specific queue.