A mutex with a global name, so it can be found from different processes. More...
#include <named_mutex.hpp>
Public Types | |
typedef interprocess_mutex | internal_mutex_type |
Public Member Functions | |
shm_named_mutex (create_only_t create_only, const char *name, const permissions &perm=permissions()) | |
Creates a global interprocess_mutex with a name. More... | |
shm_named_mutex (open_or_create_t open_or_create, const char *name, const permissions &perm=permissions()) | |
Opens or creates a global mutex with a name. More... | |
shm_named_mutex (open_only_t open_only, const char *name) | |
Opens a global mutex with a name if that mutex is previously created. More... | |
~shm_named_mutex () | |
Destroys *this and indicates that the calling process is finished using the resource. More... | |
void | unlock () |
Unlocks a previously locked interprocess_mutex. More... | |
void | lock () |
Locks interprocess_mutex, sleeps when interprocess_mutex is already locked. More... | |
bool | try_lock () |
Tries to lock the interprocess_mutex, returns false when interprocess_mutex is already locked, returns true when success. More... | |
bool | timed_lock (const boost::posix_time::ptime &abs_time) |
Tries to lock the interprocess_mutex until time abs_time, Returns false when timeout expires, returns true when locks. More... | |
interprocess_mutex & | internal_mutex () |
Static Public Member Functions | |
static bool | remove (const char *name) |
Erases a named mutex from the system. More... | |
Friends | |
class | named_condition |
class | ipcdetail::interprocess_tester |
A mutex with a global name, so it can be found from different processes.
This mutex can't be placed in shared memory, and each process should have it's own named mutex.
|
inline |
Creates a global interprocess_mutex with a name.
Throws interprocess_exception on error.
|
inline |
Opens or creates a global mutex with a name.
If the mutex is created, this call is equivalent to shm_named_mutex(create_only_t, ... ) If the mutex is already created, this call is equivalent shm_named_mutex(open_only_t, ... ) Does not throw
|
inline |
Opens a global mutex with a name if that mutex is previously created.
If it is not previously created this function throws interprocess_exception.
|
inline |
Destroys *this and indicates that the calling process is finished using the resource.
The destructor function will deallocate any system resources allocated by the system for use by this process for this resource. The resource can still be opened again calling the open constructor overload. To erase the resource from the system use remove().
|
inline |
Referenced by lock(), timed_lock(), try_lock(), and unlock().
|
inline |
Locks interprocess_mutex, sleeps when interprocess_mutex is already locked.
Throws interprocess_exception if a severe error is found
References internal_mutex(), and boost::interprocess::interprocess_mutex::lock().
Referenced by boost::interprocess::named_mutex::lock().
|
inlinestatic |
Erases a named mutex from the system.
Returns false on error. Never throws.
References boost::interprocess::shared_memory_object::remove().
Referenced by boost::interprocess::named_mutex::remove().
|
inline |
Tries to lock the interprocess_mutex until time abs_time, Returns false when timeout expires, returns true when locks.
Throws interprocess_exception if a severe error is found
References internal_mutex(), and boost::interprocess::interprocess_mutex::timed_lock().
Referenced by boost::interprocess::named_mutex::timed_lock().
|
inline |
Tries to lock the interprocess_mutex, returns false when interprocess_mutex is already locked, returns true when success.
Throws interprocess_exception if a severe error is found
References internal_mutex(), and boost::interprocess::interprocess_mutex::try_lock().
Referenced by boost::interprocess::named_mutex::try_lock().
|
inline |
Unlocks a previously locked interprocess_mutex.
References internal_mutex(), and boost::interprocess::interprocess_mutex::unlock().
Referenced by boost::interprocess::named_mutex::unlock().
|
friend |
|
friend |