Wt  3.3.8
Public Member Functions | List of all members
Wt::WApplication::UpdateLock Class Reference

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.
 

Detailed Description

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.

Constructor & Destructor Documentation

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:

WApplication::UpdateLock lock(app);
if (lock) {
// exclusive access to app state
}
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.

Deprecated:
use UpdateLock(WApplication *) instead of getUpdateLock() which requires this copy.

Member Function Documentation

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).


Generated on Mon Sep 4 2017 for the C++ Web Toolkit (Wt) by doxygen 1.8.11