Ocular Engine
Ocular::Core::ThreadManager Class Reference

#include <ThreadManager.hpp>

Detailed Description

Primarily a wrapper around the C++ standard concurrency library.

Async Example 1:

Launch four asynchronous tasks, and wait for them all to complete manually.

auto func = [](uint32_t const index)->void { ... do something ... };

auto task0 = OcularThreads->spawnAsyncNow(func, 0);
auto task1 = OcularThreads->spawnAsyncNow(func, 1);
auto task2 = OcularThreads->spawnAsyncNow(func, 2);
auto task3 = OcularThreads->spawnAsyncNow(func, 3);

task0.wait();
task1.wait();
task2.wait();
task3.wait();

Async Example 2:

Launch four asynchronous tasks, and wait for them in a single call.

auto func = [](uint32_t const index){ ... do something ... };

OcularThreads->waitForAsyncs<void>(
    &OcularThreads->spawnAsyncNow(func, 0),
    &OcularThreads->spawnAsyncNow(func, 1),
    &OcularThreads->spawnAsyncNow(func, 2),
    &OcularThreads->spawnAsyncNow(func, 3));

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