Shared Persistent Heap Data Environment Manual  1.1.0
sphlockfreeheap.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2014 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_LOCK_FREE_HEAP_H
13 #define __SPH_LOCK_FREE_HEAP_H
14 
60 #include "sastype.h"
61 
66 typedef void *SPHLockFreeHeap_t;
67 
68 #ifdef __cplusplus
69 #define __C__ "C"
70 #else
71 #define __C__
72 #endif
73 
91 SPHLockFreeHeapInit (void *heap_block , sas_type_t sasType,
92  block_size_t heap_size, size_t unit_size);
93 
106 extern __C__ SPHLockFreeHeap_t
107 SPHLockFreeHeapCreate (block_size_t heap_size, size_t unit_size);
108 
116 extern __C__ int
118 
125 extern __C__ block_size_t
127 
134 extern __C__ int
136 
143 extern __C__ int
145 
159 extern __C__ void *
160 SPHLockFreeHeapAlloc (SPHLockFreeHeap_t heap, block_size_t alloc_size);
161 
178 extern __C__ void *
180  block_size_t alloc_size,
181  block_size_t alignment);
182 
198 extern __C__ void*
199 SPHLockFreeHeapNearAlloc(void *nearObj, long alloc_size);
200 
212 extern __C__ int
214  void *free_block);
215 
227 extern __C__ int
228 SPHLockFreeHeapFreeNear (void *free_block);
229 
241 extern __C__ int
243  void *free_block);
244 
258 extern __C__ int
260  void *free_block,
261  block_size_t alloc_size);
262 
276 extern __C__ int
277 SPHLockFreeHeapFreeNearChk (void *free_block,
278  block_size_t alloc_size);
279 
293 SPHLockFreeHeapNearFind(void *nearObj);
294 
295 #if 0
296 /* Would be used for integral allocations but is currently not used */
297 extern __C__ void
298 SPHLockFreeHeapNearDealloc(void *memAddr, long allocSize);
299 #endif
300 
301 #endif /* __SPH_LOCK_FREE_HEAP_H */
__C__ void * SPHLockFreeHeapAlloc(SPHLockFreeHeap_t heap, block_size_t alloc_size)
Suballocate memory from a lock-free heap.
__C__ SPHLockFreeHeap_t SPHLockFreeHeapCreate(block_size_t heap_size, size_t unit_size)
Create a lock free heap in a shared storage block.
__C__ int SPHLockFreeHeapFreeNearChk(void *free_block, block_size_t alloc_size)
Verify size of the allocation before freeing memory.
__C__ void * SPHLockFreeHeapNearAlloc(void *nearObj, long alloc_size)
Suballocate memory from a lock free heap, close to a previous allocation.
__C__ void * SPHLockFreeHeapAlignAlloc(SPHLockFreeHeap_t heap, block_size_t alloc_size, block_size_t alignment)
Suballocate memory from a lock free heap at a specified alignment.
#define __C__
ignore this macro behind the curtain
Definition: sasmsync.h:32
__C__ int SPHLockFreeHeapFreeIn(SPHLockFreeHeap_t heap, void *free_block)
Free memory allocated from a lock free heap for reuse.
__C__ SPHLockFreeHeap_t SPHLockFreeHeapInit(void *heap_block, sas_type_t sasType, block_size_t heap_size, size_t unit_size)
Initialize a shared storage block as a lock free heap.
__C__ int SPHLockFreeHeapFull(SPHLockFreeHeap_t heap)
Return a boolean result indicating if the lock free heap is completely full.
__C__ int SPHLockFreeHeapFreeNear(void *free_block)
Free memory allocated from a lock free heap for reuse.
__C__ int SPHLockFreeHeapEmpty(SPHLockFreeHeap_t heap)
Return a boolean result indicating if the lock free heap is empty.
void * SPHLockFreeHeap_t
Handle to an instance of SPH Lock Free Heap.
Definition: sphlockfreeheap.h:66
__C__ int SPHLockFreeHeapDestroy(SPHLockFreeHeap_t heap)
Destroy a lock free heap and free the shared storage block.
__C__ block_size_t SPHLockFreeHeapFreeSpace(SPHLockFreeHeap_t heap)
Return the remaining allocatable free space within the specified lock free heap.. ...
__C__ int SPHLockFreeHeapFree(SPHLockFreeHeap_t heap, void *free_block)
Free memory allocated from a lock free heap for reuse.
__C__ int SPHLockFreeHeapFreeChk(SPHLockFreeHeap_t heap, void *free_block, block_size_t alloc_size)
Verify size of the allocation before freeing memory.
__C__ SPHLockFreeHeap_t SPHLockFreeHeapNearFind(void *nearObj)
Find the containing SPHLockFreeHeap for a block of memory.