Public Member Functions

Wt::WApplication::UpdateLock Class Reference

A RAII lock for manipulating and updating the application and its widgets outside of the event loop. More...

List of all members.

Public Member Functions

 UpdateLock (WApplication *app)
 Creates and locks the given application.
 UpdateLock (const UpdateLock &)
 Copy constructor (deprecated).
 operator bool () const
 Tests whether the update lock was succesfully taken.
 ~UpdateLock ()
 Releases the lock.

Detailed Description

A RAII lock for manipulating and updating the application and its widgets outside of the event loop.

You need to take this lock only when you want to manipulate widgets outside of the event loop. Inside the event loop, this lock is already held by the library itself.


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.

When one application A is trying to take the lock of an another application B, this lock behaves like a Wt::SyncLock. Thus while application A waiting for application B's update lock, application B or C may succesfully take application A's update lock, in this way avoiding dead-lock situations.

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

 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator

Generated on Fri Feb 4 2011 for the C++ Web Toolkit (Wt) by doxygen 1.7.2