Shared Persistent Heap Data Environment Manual  1.1.0
Macros | Typedefs | Functions
sassimplestack.h File Reference

Shared Address Space Simple Stack. Allocate a SAS block as stack. More...

#include "sastype.h"

Go to the source code of this file.

Macros

#define __C__
 ignore this macro behind the curtain
 

Typedefs

typedef void * SASSimpleStack_t
 Handle to SAS Simple Stack. More...
 

Functions

__C__ SASSimpleStack_t SASSimpleStackInit (void *heap_block, block_size_t block_size)
 Initialize a shared storage block as a simple stack. More...
 
__C__ SASSimpleStack_t SASSimpleStackCreate (block_size_t stack_size)
 Allocate a SAS block as a simple stack. More...
 
__C__ int SASSimpleStackDestroy (SASSimpleStack_t stack)
 Destroy a SASSimpleStack_t and free the shared storage block. More...
 
__C__ block_size_t SASSimpleStackFreeSpace (SASSimpleStack_t stack)
 Return the block free space not currently allocated to the stack. More...
 
__C__ void * SASSimpleStackAlloc (SASSimpleStack_t stack, block_size_t alloc_size)
 Atomically allocate a sub range of a SAS Simple Stack as a push down stack. More...
 
__C__ void * SASSimpleStackNearAlloc (void *near_stack, block_size_t alloc_size)
 Atomically allocate a sub range of a SAS Simple Stack as a push down stack. More...
 
__C__ int SASSimpleStackDealloc (SASSimpleStack_t stack, void *stack_pointer)
 Atomically deallocate a sub range of a SAS Simple Stack by reseting the stack top. More...
 
__C__ int SASSimpleStackDestroyNoLock (SASSimpleStack_t stack)
 Destroy a SASSimpleStack_t and free the shared storage block. More...
 
__C__ block_size_t SASSimpleStackFreeSpaceNoLock (SASSimpleStack_t stack)
 Return the block free space not currently allocated to the stack. More...
 
__C__ void * SASSimpleStackAllocNoLock (SASSimpleStack_t stack, block_size_t alloc_size)
 Allocate a sub range of a SAS Simple Stack as s push down stack. More...
 
__C__ void * SASSimpleStackNearAllocNoLock (void *near_stack, block_size_t alloc_size)
 Allocate a sub range of a SAS Simple Stack as a push down stack. More...
 
__C__ int SASSimpleStackDeallocNoLock (SASSimpleStack_t stack, void *stack_pointer)
 Deallocate a sub range of a SAS Simple Stack by reseting the stack top. More...
 

Detailed Description

Shared Address Space Simple Stack. Allocate a SAS block as stack.

!

Typedef Documentation

typedef void* SASSimpleStack_t

Handle to SAS Simple Stack.

The type is SAS_RUNTIME_SIMPLESTACK

Function Documentation

__C__ void* SASSimpleStackAlloc ( SASSimpleStack_t  stack,
block_size_t  alloc_size 
)

Atomically allocate a sub range of a SAS Simple Stack as a push down stack.

Parameters
stackHandle of a SAS Simple Stack.
alloc_sizesize of the simple space within the block.
Returns
Address of the allocated space or NULL if the stack is full.
__C__ void* SASSimpleStackAllocNoLock ( SASSimpleStack_t  stack,
block_size_t  alloc_size 
)

Allocate a sub range of a SAS Simple Stack as s push down stack.

Parameters
stackHandle of a SAS Simple Stack.
alloc_sizesize of the simple space within the block.
Returns
Address of the allocated space or NULL if the stack is full.
__C__ SASSimpleStack_t SASSimpleStackCreate ( block_size_t  stack_size)

Allocate a SAS block as a simple stack.

Initialize the control blocks within the specified storage block as a Simple Stack. The storage block must be power of two in size. The type should be SAS_RUNTIME_SIMPLESPACE.

Parameters
stack_sizesize of the simple space within the block.
Returns
a handle to the created SASSimpleStack_t.
__C__ int SASSimpleStackDealloc ( SASSimpleStack_t  stack,
void *  stack_pointer 
)

Atomically deallocate a sub range of a SAS Simple Stack by reseting the stack top.

Parameters
stackHandle of a SAS Simple Stack.
stack_pointerThe new stack top.
Returns
a 0 value indicates success, otherwise failure.
__C__ int SASSimpleStackDeallocNoLock ( SASSimpleStack_t  stack,
void *  stack_pointer 
)

Deallocate a sub range of a SAS Simple Stack by reseting the stack top.

Parameters
stackHandle of a SAS Simple Stack.
stack_pointerThe new stack top.
Returns
a 0 value indicates success, otherwise failure.
__C__ int SASSimpleStackDestroy ( SASSimpleStack_t  stack)

Destroy a SASSimpleStack_t and free the shared storage block.

The sas_type_t must be SAS_RUNTIME_SIMPLESTACK. Destroy holds an exclusive write while clearing the control blocks and freeing the SAS block.

Parameters
stackhandle of the SASSimpleSpace_t to be destroyed.
Returns
a 0 value indicates success, otherwise failure.
__C__ int SASSimpleStackDestroyNoLock ( SASSimpleStack_t  stack)

Destroy a SASSimpleStack_t and free the shared storage block.

The sas_type_t must be SAS_RUNTIME_SIMPLESTACK.

Parameters
stackhandle of the SASSimpleSpace_t to be destroyed.
Returns
a 0 value indicates success, otherwise failure.
__C__ block_size_t SASSimpleStackFreeSpace ( SASSimpleStack_t  stack)

Return the block free space not currently allocated to the stack.

Parameters
stackHandle of a SAS Simple Stack.
Returns
the size of the remaining free space.
__C__ block_size_t SASSimpleStackFreeSpaceNoLock ( SASSimpleStack_t  stack)

Return the block free space not currently allocated to the stack.

Parameters
stackHandle of a SAS Simple Stack.
Returns
the size of the remaining free space.
__C__ SASSimpleStack_t SASSimpleStackInit ( void *  heap_block,
block_size_t  block_size 
)

Initialize a shared storage block as a simple stack.

Initialize the control blocks within the specified storage block as a Simple Stack. The storage block must be power of two in size and have the same power of two (or better) alignment. The type should be SAS_RUNTIME_SIMPLESTACK.

Parameters
heap_blocka block of allocated SAS storage.
block_sizepower of two size of the heap to be initialized.
Returns
a handle to the initialized SASSimpleStack_t
__C__ void* SASSimpleStackNearAlloc ( void *  near_stack,
block_size_t  alloc_size 
)

Atomically allocate a sub range of a SAS Simple Stack as a push down stack.

Find the associated SASSimpleStack_t control block and use it to allocate stack space.

Parameters
near_stackHandle of a SAS Simple Stack.
alloc_sizesize of the simple space within the block.
Returns
Address of the allocated space or NULL if the stack is full.
__C__ void* SASSimpleStackNearAllocNoLock ( void *  near_stack,
block_size_t  alloc_size 
)

Allocate a sub range of a SAS Simple Stack as a push down stack.

Find the associated SASSimpleStack_t control block and use it to allocate stack space.

Parameters
near_stackHandle of a SAS Simple Stack.
alloc_sizesize of the simple space within the block.
Returns
Address of the allocated space or NULL if the stack is full.