sphlockfreeheap.h
Go to the documentation of this file.
/*
* Copyright (c) 2011-2014 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_LOCK_FREE_HEAP_H
#define __SPH_LOCK_FREE_HEAP_H
#include "sastype.h"
typedef void *SPHLockFreeHeap_t;
#ifdef __cplusplus
#define __C__ "C"
#else
#define __C__
#endif
extern __C__ SPHLockFreeHeap_t
SPHLockFreeHeapInit (void *heap_block , sas_type_t sasType,
block_size_t heap_size, size_t unit_size);
extern __C__ SPHLockFreeHeap_t
SPHLockFreeHeapCreate (block_size_t heap_size, size_t unit_size);
extern __C__ int
SPHLockFreeHeapDestroy (SPHLockFreeHeap_t heap);
extern __C__ block_size_t
SPHLockFreeHeapFreeSpace (SPHLockFreeHeap_t heap);
extern __C__ int
SPHLockFreeHeapEmpty (SPHLockFreeHeap_t heap);
extern __C__ int
SPHLockFreeHeapFull (SPHLockFreeHeap_t heap);
extern __C__ void *
SPHLockFreeHeapAlloc (SPHLockFreeHeap_t heap, block_size_t alloc_size);
extern __C__ void *
SPHLockFreeHeapAlignAlloc (SPHLockFreeHeap_t heap,
block_size_t alloc_size,
block_size_t alignment);
extern __C__ void*
SPHLockFreeHeapNearAlloc(void *nearObj, long alloc_size);
extern __C__ int
SPHLockFreeHeapFree (SPHLockFreeHeap_t heap,
void *free_block);
extern __C__ int
SPHLockFreeHeapFreeNear (void *free_block);
extern __C__ int
SPHLockFreeHeapFreeIn (SPHLockFreeHeap_t heap,
void *free_block);
extern __C__ int
SPHLockFreeHeapFreeChk (SPHLockFreeHeap_t heap,
void *free_block,
block_size_t alloc_size);
extern __C__ int
SPHLockFreeHeapFreeNearChk (void *free_block,
block_size_t alloc_size);
extern __C__ SPHLockFreeHeap_t
SPHLockFreeHeapNearFind(void *nearObj);
#if 0
/* Would be used for integral allocations but is currently not used */
extern __C__ void
SPHLockFreeHeapNearDealloc(void *memAddr, long allocSize);
#endif
#endif /* __SPH_LOCK_FREE_HEAP_H */
__C__
#define __C__
ignore this macro behind the curtain
Definition: sasmsync.h:32
SPHLockFreeHeapAlloc
__C__ void * SPHLockFreeHeapAlloc(SPHLockFreeHeap_t heap, block_size_t alloc_size)
Suballocate memory from a lock-free heap.
SPHLockFreeHeapFreeIn
__C__ int SPHLockFreeHeapFreeIn(SPHLockFreeHeap_t heap, void *free_block)
Free memory allocated from a lock free heap for reuse.
SPHLockFreeHeapEmpty
__C__ int SPHLockFreeHeapEmpty(SPHLockFreeHeap_t heap)
Return a boolean result indicating if the lock free heap is empty.
SPHLockFreeHeapFreeNear
__C__ int SPHLockFreeHeapFreeNear(void *free_block)
Free memory allocated from a lock free heap for reuse.
SPHLockFreeHeapFreeNearChk
__C__ int SPHLockFreeHeapFreeNearChk(void *free_block, block_size_t alloc_size)
Verify size of the allocation before freeing memory.
SPHLockFreeHeapInit
__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.
SPHLockFreeHeapFreeSpace
__C__ block_size_t SPHLockFreeHeapFreeSpace(SPHLockFreeHeap_t heap)
Return the remaining allocatable free space within the specified lock free heap..
SPHLockFreeHeapCreate
__C__ SPHLockFreeHeap_t SPHLockFreeHeapCreate(block_size_t heap_size, size_t unit_size)
Create a lock free heap in a shared storage block.
SPHLockFreeHeapFreeChk
__C__ int SPHLockFreeHeapFreeChk(SPHLockFreeHeap_t heap, void *free_block, block_size_t alloc_size)
Verify size of the allocation before freeing memory.
SPHLockFreeHeap_t
void * SPHLockFreeHeap_t
Handle to an instance of SPH Lock Free Heap.
Definition: sphlockfreeheap.h:66
SPHLockFreeHeapFull
__C__ int SPHLockFreeHeapFull(SPHLockFreeHeap_t heap)
Return a boolean result indicating if the lock free heap is completely full.
SPHLockFreeHeapNearFind
__C__ SPHLockFreeHeap_t SPHLockFreeHeapNearFind(void *nearObj)
Find the containing SPHLockFreeHeap for a block of memory.
SPHLockFreeHeapNearAlloc
__C__ void * SPHLockFreeHeapNearAlloc(void *nearObj, long alloc_size)
Suballocate memory from a lock free heap, close to a previous allocation.
SPHLockFreeHeapFree
__C__ int SPHLockFreeHeapFree(SPHLockFreeHeap_t heap, void *free_block)
Free memory allocated from a lock free heap for reuse.
SPHLockFreeHeapAlignAlloc
__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.
SPHLockFreeHeapDestroy
__C__ int SPHLockFreeHeapDestroy(SPHLockFreeHeap_t heap)
Destroy a lock free heap and free the shared storage block.