clan::RunLoop Class Reference - ClanLib SDK
Description: clan::RunLoop Class Reference

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.
static void | main_thread_async (std::function< void()> func)
| Executes a function on the main thread during message processing.
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.
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.
static void | run ()
| Continously process messages until RunLoop::exit() is called.

## Detailed Description

Main thread message pump processing.

## Member Function Documentation

## ◆ exit()

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

Signal that message processing should end immediately.

## ◆ main_thread_async()

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(), and main_thread_task().

## ◆ main_thread_task() [1/2]

template<typename T >

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

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

## ◆ main_thread_task() [2/2]

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

References main_thread_async().

## ◆ process()

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

## ◆ run()

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