Wt
3.3.8
|
A RAII lock for manipulating and updating the application and its widgets outside of the event loop. More...
Public Member Functions | |
UpdateLock (WApplication *app) | |
Creates and locks the given application. More... | |
UpdateLock (const UpdateLock &) | |
Copy constructor (deprecated). More... | |
operator bool () const | |
Tests whether the update lock was succesfully taken. More... | |
~UpdateLock () | |
Releases the lock. | |
A RAII lock for manipulating and updating the application and its widgets outside of the event loop.
You can use this lock to manipulate widgets outside of the event loop. Inside the event loop (including events posted using WServer::post()), this lock is already held by the library itself.
The lock is recursive, so trying to take a lock, while already holding a lock, will not block.
Wt::WApplication::UpdateLock::UpdateLock | ( | WApplication * | app | ) |
Creates and locks the given application.
The lock guarantees exclusive access to modify the application's state.
You should also consider WServer::post() for lock-free communication between different application sessions.
As soon as the library decides to destroy the application, the lock will no longer succeed in taking the application lock. You can need to detect this by checking that after the lock is taken, the lock is taken:
Wt::WApplication::UpdateLock::UpdateLock | ( | const UpdateLock & | other | ) |
Copy constructor (deprecated).
By copying the lock, lock ownership is transferred. The original object becomes empty, and its destructor has no longer the effect of releasing the lock.
Wt::WApplication::UpdateLock::operator bool | ( | ) | const |
Tests whether the update lock was succesfully taken.
This may return false
when the library has already decided to destroy the session (but before your application finalizer/destructor has run to notify helper threads that the application is destroyed).