quic/qbox
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | List of all members
gs::MemoryServices Class Reference

Public Member Functions

const charname () const
 
size_t get_shmem_seg_num () const
 
void cleanup ()
 
void init ()
 
 MemoryServices (MemoryServices const &)=delete
 
void operator= (MemoryServices const &)=delete
 
void start_shm_cleaner_proc ()
 
uint8_tmap_file (const char *mapfile, uint64_t size, uint64_t offset)
 
uint8_tmap_mem_create (const char *memname, uint64_t size, int *o_fd)
 
uint8_tmap_mem_join (const char *memname, size_t size)
 
uint8_talloc (uint64_t size)
 

Static Public Member Functions

static void cleanupexit ()
 
static MemoryServicesget ()
 

Member Function Documentation

◆ start_shm_cleaner_proc()

void gs::MemoryServices::start_shm_cleaner_proc ( )

fork a new child process to cleanup the shared memory opened in this parent process in case the parent process was killed gracefully using kill -9 (SIGKILL) or in case of uncaught run time error. For the child process to know that the parent was killed, an unmamed unix domain socket will be opened in the parent and the child processes, close one of the socket fds in the parent and close the other in the child, and poll for POLLHUB in the child to detect that the parent is hanging (may be because it is killed), in this case use the m_shmem_info_map shread with the child to clean all the opened shm instances.

these signals are already handled on the parent process block them here and wait for parent exit.


The documentation for this class was generated from the following files: