kanzi::SuspensionManager Class Reference

Suspension manager implements logic for suspending the UI thread when there is no input, tasks or timed events. More...

#include <kanzi/core.ui/platform/application/common/suspension_manager.hpp>

Public Member Functions

 SuspensionManager ()
 Constructor. More...
 
 ~SuspensionManager ()
 Destructor. More...
 
void setTaskDispatcherEventHandle (NativeEventHandle nativeHandle)
 Sets the native event handle that is used in waiting for task dispatcher. More...
 
void setInputEventHandle (NativeEventHandle nativeHandle)
 Sets the native event handle that is used in waiting for input. More...
 
bool needsPolling () const
 Checks if an event source needs polling. More...
 
void suspend (optional< chrono::milliseconds > timeout)
 Suspends the UI thread until any of the following conditions are met: More...
 
void yield (chrono::milliseconds timeout)
 Yields priority to other processes and threads for given amount of milliseconds. More...
 

Detailed Description

Suspension manager implements logic for suspending the UI thread when there is no input, tasks or timed events.

This is a class used internally by Application.

Constructor & Destructor Documentation

kanzi::SuspensionManager::SuspensionManager ( )
explicit

Constructor.

kanzi::SuspensionManager::~SuspensionManager ( )

Destructor.

Member Function Documentation

void kanzi::SuspensionManager::setTaskDispatcherEventHandle ( NativeEventHandle  nativeHandle)
inline

Sets the native event handle that is used in waiting for task dispatcher.

void kanzi::SuspensionManager::setInputEventHandle ( NativeEventHandle  nativeHandle)
inline

Sets the native event handle that is used in waiting for input.

bool kanzi::SuspensionManager::needsPolling ( ) const
inline

Checks if an event source needs polling.

Polling is needed when an event source does not have the capability to abort suspension.

Returns
True, when at least one event source needs polling.
void kanzi::SuspensionManager::suspend ( optional< chrono::milliseconds >  timeout)
inline

Suspends the UI thread until any of the following conditions are met:

  • Input is available.
  • Native windowing system messages are available.
  • Tasks in the TaskScheduler of this thread are available.
  • Timeout expires.
    Parameters
    timeoutOptional maximum suspend time.
void kanzi::SuspensionManager::yield ( chrono::milliseconds  timeout)
inline

Yields priority to other processes and threads for given amount of milliseconds.

Parameters
timeoutNumber of milliseconds to sleep. Sleeping for 0 milliseconds or returns immediately.

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