|
SCL
1.0
Standard Control Library : Control, dynamics, physics, and simulation
|
#include <CSharedMemory.hpp>
Public Member Functions | |
| CSharedMemory (const key_t &arg_shmem_key, const SignalType &arg_term_cond) | |
| bool | shmCreate () |
| bool | shmRead () |
| bool | shmAlive () |
| bool | shmCheckDetach () |
| bool | shmDetach () |
Public Attributes | |
| MemType * | data_ |
| SignalType * | data_signal_ |
| SignalType | data_terminate_ |
Private Attributes | |
| int | shmem_id_ |
| key_t | key_ |
| bool | has_been_init_ |
This class implements a shared memory setup for client-server processes to communicate "on the same computer".
For this to work, MemType must be a data structure with a fixed type. And the client and server must share the same shared memory key code.
The signal type is usually a fast (atomic) data type like atomic_t in <asm/atomic.h> on Linux.
Functions that help you use the shared memory: Server : Create : shmCreate() Use : *shmem.data_ Signal : *shmem.data_signal_ Close : shmCheckDetach()
Client : Create : shmRead() Use : *shmem.data_ Signal : *shmem.data_signal_ Close : shmDetach()
|
inline |
Terminates if *data_signal_ is set to data_terminate_
|
inline |
Terminates if *data_signal_ is set to data_terminate_
|
inline |
A shared memory server creates the shared memory
|
inline |
Terminates the shared memory
|
inline |
A shared memory client reads the shared memory
| MemType* sutil::CSharedMemory< MemType, SignalType >::data_ |
The data type
| SignalType* sutil::CSharedMemory< MemType, SignalType >::data_signal_ |
The signal data type
| SignalType sutil::CSharedMemory< MemType, SignalType >::data_terminate_ |
The signal termination condition
1.8.6