ArkScript
A small, fast, functional and scripting language for video games
Ark::internal::Future Class Reference

#include <Future.hpp>

Collaboration diagram for Ark::internal::Future:
[legend]

Public Member Functions

 Future (ExecutionContext *context, VM *vm, std::vector< Value > &args)
 Create a Future and immediately start it through std::async.
 
Value resolve ()
 Await the future, blocking the thread it is ran on.
 

Private Attributes

ExecutionContextm_context
 
VMm_vm
 
std::future< Valuem_value
 The actual thread.
 

Detailed Description

Definition at line 23 of file Future.hpp.

Constructor & Destructor Documentation

◆ Future()

Ark::internal::Future::Future ( ExecutionContext * context,
VM * vm,
std::vector< Value > & args )

Create a Future and immediately start it through std::async.

Parameters
contexta dedicated context for the future to run on
vmnon owning pointer to the VM
argslist of (function, arguments...) to create the future

Definition at line 7 of file Future.cpp.

Member Function Documentation

◆ resolve()

Value Ark::internal::Future::resolve ( )

Await the future, blocking the thread it is ran on.

Returns
Value Nil if the future is invalid (has already been awaited), otherwise the value

Definition at line 13 of file Future.cpp.

References Ark::Nil.

Member Data Documentation

◆ m_context

ExecutionContext* Ark::internal::Future::m_context
private

Definition at line 41 of file Future.hpp.

◆ m_value

std::future<Value> Ark::internal::Future::m_value
private

The actual thread.

Definition at line 43 of file Future.hpp.

◆ m_vm

VM* Ark::internal::Future::m_vm
private

Definition at line 42 of file Future.hpp.


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