File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change 1- # dispatch-queue-cs
1+ # DispatchQueue
2+
3+ A simple implementation of Apple's Grand Central Dispatch in C# with an interest in creating as few allocations as possible.
4+ This implementation also avoids locks where possible.
5+
6+ # Example Code
7+
8+ ``` C#
9+ // create a serial queue and give it a Thread pool (anything inheriting from IThreadPool, ManagedThreadPool is provided as a default implementation)
10+ SerialQueue queue = new SerialQueue (new ManagedThreadPool ());
11+
12+ // push some work to the queue
13+ queue .DispatchAsync (null , (_ ) =>
14+ {
15+ Console .WriteLine (" This is executed on a worker thread" );
16+ });
17+
18+ queue .DispatchAsync (null , (_ ) =>
19+ {
20+ Console .WriteLine (" This is also executed on a worker thread" );
21+ });
22+ ```
You can’t perform that action at this time.
0 commit comments