thorium-cfx / mono_v2_get_started

Mono v2 runtime for FiveM/RedM
38 stars 5 forks source link

Add awaitable lambda execution, like Task.Run() #7

Closed thorium-cfx closed 1 year ago

thorium-cfx commented 1 year ago

Goal

Run lambdas directly and allow await when they are being rescheduled

Importancy

Quality of Life (QoL)

API and/or potential implementation

API

Coroutine Coroutine.Run(Func<Coroutine> func)

and potentially others found in MS Task.Run specification

Implementation

Could be something like this:

return await new Func<Coroutine>(async () =>
{
    // our lambda
})();

Extra

No response