Skip to content

A simple implementation of Apple's Grand Central Dispatch in C# with an interest in creating as few allocations as possible

License

Notifications You must be signed in to change notification settings

BladeBreaker/dispatch-queue-cs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DispatchQueue

A simple implementation of Apple's Grand Central Dispatch in C# with an interest in creating as few allocations as possible. This implementation also avoids locks where possible.

Example Code

// create a serial queue and give it a Thread pool (anything inheriting from IThreadPool, ManagedThreadPool is provided as a default implementation)
SerialQueue queue = new SerialQueue(new ManagedThreadPool());

// push some work to the queue
queue.DispatchAsync(null, (_) =>
{
    Console.WriteLine("This is executed on a worker thread");
});

queue.DispatchAsync(null, (_) =>
{
    Console.WriteLine("This is also executed on a worker thread");
});

About

A simple implementation of Apple's Grand Central Dispatch in C# with an interest in creating as few allocations as possible

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages