The OpenD Programming Language

guiThreadExists

Returns true if a gui thread exists, that is, a thread running the simpledisplay.d event loop. All windows must be exclusively created and managed by a single thread.

If no gui thread exists, simpledisplay.d will automatically adopt the current thread when you call one of its constructors.

If a gui thread exists, you should check thisThreadRunningGui to see if it is this one. If so, you can run gui functions on it. If not, don't. The helper functions runInGuiThread and runInGuiThreadAsync can be used to help you with this automatically.

The reason this function is available is in case you want to message pass between a gui thread and your current thread. If no gui thread exists or if this is the gui thread, you're liable to deadlock when trying to communicate since you'd end up talking to yourself.

bool
guiThreadExists
()

Meta

History

Added December 3, 2021 (dub v10.5)