Best Practices

Singleton for Manager

An easy way to make the manager globally accessible is to create a singleton:

using TaskProperties = rg::TaskProperties< /*...*/ >;
static auto & mgr()
{
    static rg::Manager<
        TaskProperties,
        rg::ResourceEnqueuePolicy,
        MyScheduler
    > m;

    return m;
}

void foo()
{
    mgr().emplace_task( []{ /* ... */ } );
}

Lifetimes of Captured Variables

use shared_ptr

Task-Results

always use auto

Writing Container Classes

If you implement a structure which should be used as resource, then just derive from the corresponding resource type:

struct MyContainer : rg::IOResource {
    // ...
}

TODO: Access Guards