Turi Create  4.0
Shared Memory Interprocess Communication

Classes

class  turi::shmipc::server
 
class  turi::shmipc::client
 

Functions

template<typename T >
bool turi::shmipc::large_send (T &shm, const char *c, size_t len)
 
template<typename T >
bool turi::shmipc::large_receive (T &shm, char **c, size_t *clen, size_t &receivelen, size_t timeout)
 
std::shared_ptr< raii_deleter > turi::shmipc::register_shared_memory_name (std::string m_name)
 
void turi::shmipc::garbage_collect ()
 

Detailed Description

Function Documentation

◆ garbage_collect()

void turi::shmipc::garbage_collect ( )

Collects all unused shared memory segments

◆ large_receive()

template<typename T >
bool turi::shmipc::large_receive ( T &  shm,
char **  c,
size_t *  clen,
size_t &  receivelen,
size_t  timeout 
)

Receives an arbitrarily large amount of data through an SHMIPC channel. T can be either a server or a client. Receiver must use the matching large_receive function.

Definition at line 210 of file shmipc.hpp.

◆ large_send()

template<typename T >
bool turi::shmipc::large_send ( T &  shm,
const char *  c,
size_t  len 
)

Send an arbitrarily large amount of data through an SHMIPC channel. T can be either a server or a client. Receiver must use the matching large_receive function.

Definition at line 164 of file shmipc.hpp.

◆ register_shared_memory_name()

std::shared_ptr<raii_deleter> turi::shmipc::register_shared_memory_name ( std::string  m_name)

For a given shared memory segment name, m_name, this function returns a scoped deleter object which unlinks the shared memory segment on destruction.

Internally, the RAII deleter contains a pair of a shared memory filename and a "tag" filename which is used to indicate that the shared memory file exists. The tag filename is used in shared memory garbage collection and is located as [system temp directory]/glshm_[userid]/[shmname]

The reason for having a directory for each userid is to avoid permission issues. Each tag file contains inside of it, the PID of the server process.