quill
Public Member Functions | List of all members
detail::BackendWorkerLock Class Reference

Ensures that only one instance of the backend worker is active. More...

#include <BackendWorkerLock.h>

Public Member Functions

 BackendWorkerLock (std::string const &pid)
 
 BackendWorkerLock (BackendWorkerLock const &)=delete
 
BackendWorkerLockoperator= (BackendWorkerLock const &)=delete
 

Detailed Description

Ensures that only one instance of the backend worker is active.

This class provides a mechanism to prevent multiple instances of the backend worker from running within the same process. This can occur due to inconsistent linkage (e.g., mixing static and shared libraries), potentially leading to duplicate backend worker threads and unexpected behavior.

On Windows, it utilizes a named mutex. On POSIX systems (Linux, macOS), it uses flock() on a lock file in /tmp. The kernel automatically releases the lock when the process exits, even on kill -9, so no stale locks are left behind.

Disabled on Android, which lacks /tmp.


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