ImmutableOctet / glare

Glare: Open Source Game Engine written in Modern C++
MIT License
0 stars 0 forks source link

Add support to stop or pause Entity Threads from the C++ script API #82

Open ImmutableOctet opened 4 months ago

ImmutableOctet commented 4 months ago

We should be able to write something like:

co_await stop();

to indicate that the current thread should be terminated. Ideally, this would work for references to other threads as well, e.g.

co_await some_other_thread.stop();

This could also be extended to pause:

if (auto other_thread = get_thread("other_thread"_hs))
{
    other_thread.pause
    (
        []()
        {
            return (some_condition_to_be_met);
        }
    );
}

although some member-functions, like until, may not make sense for this. See: #78

Related: #81