Static Public Member Functions | List of all members
clan::RunLoop Class Reference

Main thread message pump processing. More...

`#include <run_loop.h>`

## Static Public Member Functions
static void | exit ()
| Signal that message processing should end immediately. More...
static void | main_thread_async (std::function< void()> func)
| Executes a function on the main thread during message processing. More...
template<typename T >
static std::future< T > | main_thread_task (std::function< T()> func)
| Executes a task on the main thread with a future result. More...
static std::future< void > | main_thread_task (std::function< void()> func)
static bool | process (int timeout_ms=0)
| Process messages for specified amount of time. More...
static void | run ()
| Continously process messages until RunLoop::exit() is called. More...

## Detailed Description

Main thread message pump processing.

## Member Function Documentation

static void clan::RunLoop::exit | ( |  | ) |
| static

Signal that message processing should end immediately.

static void clan::RunLoop::main_thread_async | ( | std::function< void()> | func | ) |
| static

Executes a function on the main thread during message processing.

This provides a thread-safe way to execute some code on the main thread as part of the message processing step.

Referenced by main_thread_task().

template<typename T >

static std::future<T> clan::RunLoop::main_thread_task | ( | std::function< T()> | func | ) |
| inline static

Executes a task on the main thread with a future result.

This provides a thread-safe way to execute some code on the main thread as part of the message processing step. The caller can then wait and access the result of the operation through the returned future.

References main_thread_async().

static std::future<void> clan::RunLoop::main_thread_task | ( | std::function< void()> | func | ) |
| inline static

References main_thread_async().

static bool clan::RunLoop::process | ( | int | timeout_ms = `0` | ) |
| static

Process messages for specified amount of time.

Return values

  Returns | false if RunLoop::exit() has been called or the OS signalled the app needs to shut down

static void clan::RunLoop::run | ( |  | ) |
| static

Continously process messages until RunLoop::exit() is called.

The documentation for this class was generated from the following file:

- run_loop.h