LMMS
Loading...
Searching...
No Matches
rtmempool.c File Reference
#include "list.h"
#include "rtmempool.h"
#include "rtmempool-lv2.h"
#include <assert.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Classes

struct  _RtMemPool

Macros

#define RTMEMPOOL_THREAD_SAFETY   0
#define rtmempool_mutex_lock(...)
#define rtmempool_mutex_unlock(...)

Typedefs

typedef struct list_head k_list_head
typedef struct _RtMemPool RtMemPool

Functions

static void rtsafe_memory_pool_sleepy (RtMemPool *poolPtr, bool *overMaxOrMallocFailed)
static bool rtsafe_memory_pool_create2 (RtMemPool_Handle *handlePtr, const char *poolName, size_t dataSize, size_t minPreallocated, size_t maxPreallocated)
static unsigned char rtsafe_memory_pool_create_old (const char *poolName, size_t dataSize, size_t minPreallocated, size_t maxPreallocated, RtMemPool_Handle *handlePtr)
bool rtsafe_memory_pool_create (RtMemPool_Handle *handlePtr, const char *poolName, size_t dataSize, size_t minPreallocated, size_t maxPreallocated)
void rtsafe_memory_pool_destroy (RtMemPool_Handle handle)
voidrtsafe_memory_pool_allocate_atomic (RtMemPool_Handle handle)
voidrtsafe_memory_pool_allocate_sleepy (RtMemPool_Handle handle)
void rtsafe_memory_pool_deallocate (RtMemPool_Handle handle, void *memoryPtr)
void lv2_rtmempool_init (LV2_RtMemPool_Pool *poolPtr)
void lv2_rtmempool_init_deprecated (LV2_RtMemPool_Pool_Deprecated *poolPtr)

Macro Definition Documentation

◆ rtmempool_mutex_lock

#define rtmempool_mutex_lock ( ...)

◆ rtmempool_mutex_unlock

#define rtmempool_mutex_unlock ( ...)

◆ RTMEMPOOL_THREAD_SAFETY

#define RTMEMPOOL_THREAD_SAFETY   0

Typedef Documentation

◆ k_list_head

typedef struct list_head k_list_head

◆ RtMemPool

typedef struct _RtMemPool RtMemPool

Function Documentation

◆ lv2_rtmempool_init()

void lv2_rtmempool_init ( LV2_RtMemPool_Pool * poolPtr)

Initialize LV2_RTSAFE_MEMORY_POOL__Pool feature

Parameters
poolPtrhost allocated pointer to LV2_RtMemPool_Pool

◆ lv2_rtmempool_init_deprecated()

void lv2_rtmempool_init_deprecated ( LV2_RtMemPool_Pool_Deprecated * poolPtr)

◆ rtsafe_memory_pool_allocate_atomic()

void * rtsafe_memory_pool_allocate_atomic ( RtMemPool_Handle handle)

Allocate memory in context where sleeping is not allowed

will not sleep

Returns
Pointer to allocated memory or NULL if memory no memory is available

◆ rtsafe_memory_pool_allocate_sleepy()

void * rtsafe_memory_pool_allocate_sleepy ( RtMemPool_Handle handle)

Allocate memory in context where sleeping is allowed

may/will sleep

Returns
Pointer to allocated memory or NULL if memory no memory is available (should not happen under normal conditions)

◆ rtsafe_memory_pool_create()

bool rtsafe_memory_pool_create ( RtMemPool_Handle * handlePtr,
const char * poolName,
size_t dataSize,
size_t minPreallocated,
size_t maxPreallocated )

Create new memory pool

may/will sleep

Parameters
poolNamepool name, for debug purposes, max RTSAFE_MEMORY_POOL_NAME_MAX chars, including terminating zero char. May be NULL.
dataSizememory chunk size
minPreallocatedmin chunks preallocated
maxPreallocatedmax chunks preallocated
Returns
Success status, true if successful

◆ rtsafe_memory_pool_create2()

bool rtsafe_memory_pool_create2 ( RtMemPool_Handle * handlePtr,
const char * poolName,
size_t dataSize,
size_t minPreallocated,
size_t maxPreallocated )
static

◆ rtsafe_memory_pool_create_old()

unsigned char rtsafe_memory_pool_create_old ( const char * poolName,
size_t dataSize,
size_t minPreallocated,
size_t maxPreallocated,
RtMemPool_Handle * handlePtr )
static

◆ rtsafe_memory_pool_deallocate()

void rtsafe_memory_pool_deallocate ( RtMemPool_Handle handle,
void * memoryPtr )

Deallocate previously allocated memory

will not sleep

Parameters
memoryPtrpointer to previously allocated memory chunk

◆ rtsafe_memory_pool_destroy()

void rtsafe_memory_pool_destroy ( RtMemPool_Handle handle)

Destroy previously created memory pool

may/will sleep

◆ rtsafe_memory_pool_sleepy()

void rtsafe_memory_pool_sleepy ( RtMemPool * poolPtr,
bool * overMaxOrMallocFailed )
static