Skip to content

A thread-safe queue to support producer-consumer scenarios where a consumer can await on items to be processed.

License

Notifications You must be signed in to change notification settings

Envoid/AsyncQueue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AsyncQueue

A thread-safe queue to support producer-consumer scenarios where a consumer can await on items to be processed.

AsyncQueue was designed to support an application where there may be multiple producers in background threads sending messages to a single consumer for processing (e.g. sending emails). It's simple to use, essentially supporting just Enqueue and DequeueAsync methods.

Example usage

        var queue = new AsyncQueue<int>();

        // Simulate some other task posting an item for processing.
        Task.Run(() =>
            {
                Thread.Sleep(10);
                queue.Enqueue(42);
            });

        await queue.DequeueAsync();

About

A thread-safe queue to support producer-consumer scenarios where a consumer can await on items to be processed.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages