List of all members.
Detailed Description
MAppletSharedMutex provides a POSIX mutex that is located in shared memory. Initializing the shared mutex will create a shared memory segment if one is not created yet. Otherwise the already existing shared memory segment is attached. Destroying the mutex will detach from the shared memory so that when all parties have detached the segment will be freed.
Constructor & Destructor Documentation
MAppletSharedMutex::MAppletSharedMutex |
( |
|
) |
|
Creates a new shared mutex. The mutex must be initialized using init() before it can be used.
MAppletSharedMutex::~MAppletSharedMutex |
( |
|
) |
[virtual] |
Destroys the shared mutex. Detaches the shared memory so that when all parties have detached the segment will be freed.
Member Function Documentation
bool MAppletSharedMutex::init |
( |
const QString & |
key |
) |
|
Initializes the shared mutex. Creates a shared memory segment if one is not created yet. Otherwise the already existing shared memory segment is attached and the mutex is marked to be destroyed when all parties have detached.
bool MAppletSharedMutex::lock |
( |
|
) |
|
Locks the mutex. If the mutex is already locked the calling thread shall block until the mutex becomes available.
- Returns:
- true if the mutex could be locked, false otherwise
bool MAppletSharedMutex::tryLock |
( |
|
) |
|
Locks the mutex. If the mutex is already locked the function will return false immediately.
- Returns:
- true if the mutex could be locked, false otherwise
bool MAppletSharedMutex::unlock |
( |
|
) |
|
Unlocks the mutex.
- Returns:
- true if the mutex could be unlocked, false otherwise