|
quic/qbox
|
Forks a process to ensure shared memory cleanup on crash or abnormal exit. More...
#include <memory_services.h>
Public Member Functions | |
| void | add_shared_memory_region (const std::string &memname) |
| void | cleanup () |
Forks a process to ensure shared memory cleanup on crash or abnormal exit.
The ShmemCleanerService class is responsible for creating a child process (via fork) that monitors the parent process. It maintains access to the shared memory name registry and, in the event of a parent process crash or abnormal termination, ensures that all registered shared memory objects are properly released (unlinked). This mechanism helps prevent resource leaks and guarantees that shared memory segments do not persist after unexpected failures, improving system robustness and reliability.