AshleighAdams / CoroutineScheduler

Low allocation coroutines with tightly controlled concurrency

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Logo

CoroutineScheduler

CoroutineScheduler CoroutineScheduler.Core
Codecov Mutation testing score

Low allocation coroutines with tightly controlled concurrency.

Usage

Add the following to your Directory.Build.props or csproj:

<ItemGroup>
  <PackageReference Include="CoroutineScheduler" Version="x.y.z" />
</ItemGroup>
using CoroutineScheduler;

var scheduler = new Scheduler();

// spawn a coroutine
scheduler.SpawnTask(MyCoroutine);


while (true)
	scheduler.Resume();

async Task MyCoroutine()
{
	int i = 0;
	while (true)
	{
		Console.WriteLine($"Hello {i++}");
		await scheduler.Yield();
	}
}

About

Low allocation coroutines with tightly controlled concurrency

License:MIT License


Languages

Language:C# 96.5%Language:Shell 3.5%