Shared Persistent Heap Data Environment Manual  1.1.0
sphmultipcqueue.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 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, Paul Clarke - based heavily on sphsinglepcqueue
10  */
11 
12 #ifndef __SPH_MULTI_PC_QUEUE_H
13 #define __SPH_MULTI_PC_QUEUE_H
14 
139 #include "sastype.h"
140 #include "sphlfentry.h"
141 #include "sphdirectpcqueue.h"
142 
147 typedef void *SPHMPMCQ_t;
148 
150 #ifdef __cplusplus
151 #define __C__ "C"
152 #else
153 #define __C__
154 #endif
155 #if 0
156 
157 typedef unsigned long longPtr_t;
158 #endif
159 
160 #define SPHMPMCQ_CIRCULAR (1)
161 
162 #define SPHMPMCQ_CIRCULAR_WRAPPED (1<<1)
163 
164 #define SPHMPMCQ_CIRCULAR_NOTFIRST (1<<2)
165 
166 #define SPHMPMCQ_CACHE_PREFETCH0 (1<<3)
167 
168 #define SPHMPMCQ_CACHE_PREFETCH1 (1<<4)
169 
170 #define SPHMPMCQ_CIRCULAR_RESETMASK (SPHMPCQ_CIRCULAR | \
171  SPHMPCQ_CACHE_PREFETCH0 | \
172  SPHMPCQ_CACHE_PREFETCH1)
173 
186 extern __C__ SPHMPMCQ_t
187 SPHMPMCQInit (void *buf_seg , block_size_t buf_size);
188 
205 extern __C__ SPHMPMCQ_t
206 SPHMPMCQInitWithStride (void* buf_seg, block_size_t buf_size,
207  unsigned short entry_stride,
208  unsigned int options);
209 
220 extern __C__ SPHMPMCQ_t
221 SPHMPMCQCreate (block_size_t buf_size);
222 
234 extern __C__ SPHMPMCQ_t
235 SPHMPMCQCreateWithStride (block_size_t buf_size,
236  unsigned short stride);
237 
245 extern __C__ int
247 
255 extern __C__ int
257 
258 #if defined(SPH_INTERNAL)
259 
266 extern __C__ int
267 SPHMPMCQResetAsync (SPHMPMCQ_t queue);
268 #endif
269 
276 extern __C__ int
278 
285 extern __C__ int
286 SPHMPMCQIsFull (SPHMPMCQ_t queue);
287 
293 extern __C__ block_size_t
295 
304 extern __C__ sphLFEntryID_t
306 
331 
359 
377 
398 
405 extern __C__ int
407 
428 extern __C__ int
430  SPHLFEntryDirect_t entry);
431 
451 
463 extern __C__ int
464 SPHMPMCQSetCachePrefetch (SPHMPMCQ_t queue, int prefetch);
465 
471 extern __C__ int
473 
479 extern __C__ int
481 
482 #endif /* __SPH_MULTI_PC_QUEUE_H */
__C__ SPHMPMCQ_t SPHMPMCQCreateWithStride(block_size_t buf_size, unsigned short stride)
Allocate and initialize a shared storage block as a Lock Free Multi Producer Multi Consumer Queue...
__C__ SPHMPMCQ_t SPHMPMCQInitWithStride(void *buf_seg, block_size_t buf_size, unsigned short entry_stride, unsigned int options)
Initialize a shared storage block as a Multi Producer Multi Consumer Queue with a fixed entry stride...
__C__ int SPHMPMCQSetCachePrefetch(SPHMPMCQ_t queue, int prefetch)
Set the cache-line prefetch options for entry allocate.
__C__ int SPHMPMCQEntryDirectIsComplete(SPHLFEntryDirect_t directHandle)
Return the status of the entry specified by the direct entry handle.
__C__ SPHLFEntryDirect_t SPHMPMCQAllocStrideDirectHTM(SPHMPMCQ_t queue)
Allows the producer thread to allocate and initialize the header of a queue entry for access...
__C__ SPHMPMCQ_t SPHMPMCQCreate(block_size_t buf_size)
Allocate and initialize a shared storage block as a Multi Producer Multi Consumer Queue...
__C__ int SPHMPMCQIsFull(SPHMPMCQ_t queue)
Return the status of the specified queue.
__C__ SPHLFEntryDirect_t SPHMPMCQGetNextCompleteDirectHTM(SPHMPMCQ_t queue)
Allows the consumer to get the next completed queue entry from the specified multi producer multi con...
__C__ block_size_t SPHMPMCQFreeSpace(SPHMPMCQ_t queue)
Returns the amount of free space (in bytes) remaining in the specified queue.
void * SPHMPMCQ_t
Handle to an instance of SPH Multi Producer, Multi Consumer Queue.
Definition: sphmultipcqueue.h:147
Shared Persistent Heap, logger/queue etc event entry status, update, and access functions.
__C__ SPHMPMCQ_t SPHMPMCQInit(void *buf_seg, block_size_t buf_size)
Initialize a shared storage block as a MPMC Queue.
__C__ int SPHMPMCQDestroy(SPHMPMCQ_t queue)
Destroys the queue and frees the SAS storage for reuse.
__C__ SPHLFEntryDirect_t SPHSPMCQAllocStrideDirect(SPHMPMCQ_t queue)
Allows the producer thread to allocate and initialize the header of a queue entry for access...
Shared Persistent Heap, single producer single consumer queue direct API.
__C__ int SPHMPMCQPrefetch(SPHMPMCQ_t queue)
Prefetch pages from the specific queue.
unsigned long longPtr_t
unsigned int type, consistent with the size of a pointer and used for pointer calculations ...
Definition: sphlflogger.h:183
__C__ SPHLFEntryDirect_t SPHMPSCQGetNextCompleteDirect(SPHMPMCQ_t queue)
Allows the consumer to get the next completed queue entry from the specified multi producer multi con...
__C__ int SPHMPMCQGetStride(SPHMPMCQ_t queue)
Return the entry stride for an existing Lock Free Multi Producer Multi Consumer Queue.
unsigned int sphLFEntryID_t
Aggregate type for handling sphLogEntryLayout_t.
Definition: sphlfentry.h:77
#define __C__
ignore this macro behind the curtain
Definition: sphmultipcqueue.h:153
void * SPHLFEntryDirect_t
Instance of a Lock Free event direct data Handle.
Definition: sphdirectpcqueue.h:146
__C__ SPHLFEntryDirect_t SPHMPMCQGetNextEntry(SPHMPMCQ_t queue)
Allows the consumer to get the next allocated queue entry from the specified multi producer multi con...
__C__ int SPHMPMCQGetEntries(SPHMPMCQ_t queue)
Return the total number of entries for an existing Lock Free Multi Producer Multi Consumer Queue...
__C__ sphLFEntryID_t SPHMPMCQGetEntryTemplate(SPHMPMCQ_t queue)
Return the entry template for an existing Lock Free Multi Producer Multi Consumer Queue...
__C__ int SPHMPMCQIsEmpty(SPHMPMCQ_t queue)
Return the status of the specified queue.
__C__ int SPHMPMCQFreeEntryDirect(SPHMPMCQ_t queue, SPHLFEntryDirect_t entry)
Allows the consumer to free the queue entry it just processed (using SPHMPMCQGetNextComplete), from the specified multi producer multi consumer queue.