Aurore
A Switch-like interface for your app, on every screen
Loading...
Searching...
No Matches
aurore::Threading Class Reference

#include <aurore/core/thread.hpp>

Static Public Member Functions

static void sync (std::function< void()> func)
 
static void async (std::function< void()> func)
 
static void asyncDecode (std::function< void()> func)
 
static size_t delay (long milliseconds, std::function< void()> func)
 
static void cancelDelay (size_t iter)
 
static void start ()
 
static void stop ()
 
static void performSyncTasks ()
 
static void setSyncTaskBudget (uint64_t microseconds)
 
static bool isIdle ()
 

Member Function Documentation

◆ async()

static void aurore::Threading::async ( std::function< void()>  func)
static

Enqueue a function to be executed in parallel with application's main thread.

◆ asyncDecode()

static void aurore::Threading::asyncDecode ( std::function< void()>  func)
static

As async(), on a thread of its own for decoding pictures (ThemeImages, Image::setImageFromFileAsync): a large picture does not hold back the tasks of async() (the battery, the Wi-Fi, the app's own).

◆ cancelDelay()

static void aurore::Threading::cancelDelay ( size_t  iter)
static

◆ delay()

static size_t aurore::Threading::delay ( long  milliseconds,
std::function< void()>  func 
)
static

◆ isIdle()

static bool aurore::Threading::isIdle ( )
static

True when no task is queued with sync(), async() or asyncDecode() and none is running on their threads (delay()s are not counted). The test harness waits for it before it calls a screen settled.

◆ performSyncTasks()

static void aurore::Threading::performSyncTasks ( )
static

◆ setSyncTaskBudget()

static void aurore::Threading::setSyncTaskBudget ( uint64_t  microseconds)
static

Bounds the time the sync tasks may take on a frame, in microseconds: once it is spent, the tasks left run on the next frames, in order, so a burst of results (a page of covers) does not stall a frame. 0, the default, runs every task on the frame it was queued for.

◆ start()

static void aurore::Threading::start ( )
static

◆ stop()

static void aurore::Threading::stop ( )
static

◆ sync()

static void aurore::Threading::sync ( std::function< void()>  func)
static

Enqueue a function to be executed before the application is redrawn the next time.

Aurore is not thread-safe, and sync() provides a mechanism for queuing up UI-related state changes from other threads.


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