Documentation: The Application Class [Remove Frame]

The FXApp Class

Event Loops

Event Queues

Types of Event Loops

Global Application Mutex

When programming with multiple threads of control, one single thread (the Main Thread) is responsible for the User Interface, while other threads are Worker Threads churning in the background.  Occasionally, the Worker Threads need to interact with the Main Thread.
This is accomplished by means of the global application mutex.

When the display is opened, the Main Thread acquires the global application Mutex. It continues to hold this Mutex while it is processing events, until the Main Thread is about to enter a blocking state. 

Just before entering the blocking state, the Main Thread releases the global application Mutex.  Worker Threads are then free to acquire the
global Mutex and then play around with data structures safely.  As soon as an event comes in, the Main Thread wakes up and immediately reacquires the global application Mutex.
Thus, basically every message or callback in the system is performed while the global Mutex is held by the Main Thread.  This ensures that no Worker Thread is simultaneously modifying some data structure when the Main Thread is also.

The Main Thread continues to hold the global Mutex until display is closed.

The global Mutex may be obtained by reference with the function:
Having the Mutex returned as a reference allows it to be passed directly into the FXMutexLock convenience class, which performs Mutex locking and unlocking by means of constructor and destructor.

GUI Updating


Wait Cursors

Drag Types

The drag types must be mime types as defined in the XDND standard.

Copyright © 1997-2022 Jeroen van der Zijp