| Shared Memory Interface | |
| tnt_shmem.h | |
| Includes | |
| “tnt_shmem_barrier. | Specifies the barrier function prototypes of the shared memory API. |
| “tnt_shmem_mutex. | Specifies the mutex function prototypes of the shared memory API. |
| “tnt_shmem_util. | Specifies the utility function prototypes of the shared memory API. |
| Typedefs | |
| tnt_shmem_chunk_t | A global shared memory address. |
| Initialization and Finalization | |
| tnt_shmem_init | Initializes a global shared memory, as well as DCMF and all associated global variables. |
| tnt_shmem_finalize | Destroys the global shared memory, all associated variables, and finalizes DCMF. |
| Memory Allocation | |
| tnt_shmem_malloc | Malloc a block of memory from the global shared memory in bytes specified by size. |
| tnt_shmem_free | Free a malloc’d block of memory. |
| Read and Write | |
| tnt_shmem_read | Read from a shared memory region. |
| tnt_shmem_write | Write to a shared memory region |
tnt_ret_t tnt_shmem_init( size_t size )
Initializes a global shared memory, as well as DCMF and all associated global variables. Not thread safe.
| size | the amount of memory in bytes to allocate for global memory. |
| 1 | if success when called the first time. |
| 0 | for every subsequent call. |
| < 0 | on failure when called the first time. |
tnt_ret_t tnt_shmem_read( tnt_shmem_chunk_t * src, void * buffer, size_t size )
Read from a shared memory region.
| src | The source chunk to read data from. |
| buffer | The local buffer to store the read data in. |
| size | The amount of data to copy from shared memory. |
| 0 | on success. |
| < 0 | on failure. |
tnt_ret_t tnt_shmem_write( tnt_shmem_chunk_t * dst, void * buffer, size_t size )
Write to a shared memory region
| dst | The destination chunk to write data to. |
| buffer | The local buffer containing the data to write. |
| size | The amount of data to copy to shared memory. |
| 0 | on success. |
| < 0 | on failure. |
Specifies the barrier function prototypes of the shared memory API.
#include "tnt_shmem_barrier.h"
Specifies the mutex function prototypes of the shared memory API.
#include "tnt_shmem_mutex.h"
Specifies the utility function prototypes of the shared memory API.
#include "tnt_shmem_util.h"
A global shared memory address.
typedef void tnt_shmem_chunk_t
Initializes a global shared memory, as well as DCMF and all associated global variables.
tnt_ret_t tnt_shmem_init( size_t size )
Destroys the global shared memory, all associated variables, and finalizes DCMF.
tnt_ret_t tnt_shmem_finalize()
Malloc a block of memory from the global shared memory in bytes specified by size.
tnt_shmem_chunk_t* tnt_shmem_malloc( size_t size )
Free a malloc’d block of memory.
void tnt_shmem_free( tnt_shmem_chunk_t * chunk )
Read from a shared memory region.
tnt_ret_t tnt_shmem_read( tnt_shmem_chunk_t * src, void * buffer, size_t size )
Write to a shared memory region
tnt_ret_t tnt_shmem_write( tnt_shmem_chunk_t * dst, void * buffer, size_t size )