Vigilante Game Framework  1.0.0.8
A 2D/3D C++ Game Framework using SFML.
Public Member Functions | List of all members
VAsync Class Reference

Handler for asynchronous functions. More...

#include <VAsync.h>

Public Member Functions

bool ActiveAsyncFunctions ()
 
void LaunchAsyncFunction (std::future< void > &f)
 
void SyncToMainLoop (std::function< void()> callback)
 
void ProcessSyncRequests ()
 

Detailed Description

Handler for asynchronous functions.

Member Function Documentation

◆ ActiveAsyncFunctions()

bool VAsync::ActiveAsyncFunctions ( )
Returns
If there are any asynchronous functions currently being handled, then the function returns true. Good for preventing certain actions from occuring while other threads are active (like state changes).

◆ LaunchAsyncFunction()

void VAsync::LaunchAsyncFunction ( std::future< void > &  f)
Parameters
fThe std::future object that represents the asynchronous function (i.e. from calling std::async).

◆ ProcessSyncRequests()

void VAsync::ProcessSyncRequests ( )

Called in VGame to process all the sync requests from the SyncQueue.

◆ SyncToMainLoop()

void VAsync::SyncToMainLoop ( std::function< void()>  callback)

Function to tell the game's main thread to sync the current function back to the main one. This function MUST be called at the end of an asynchronous function.

Parameters
callbackA callback function used to respond to the notification that the asynchronous function has finished.

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