CoCoL 1.8.1
dotnet add package CoCoL --version 1.8.1
NuGet\Install-Package CoCoL -Version 1.8.1
<PackageReference Include="CoCoL" Version="1.8.1" />
paket add CoCoL --version 1.8.1
#r "nuget: CoCoL, 1.8.1"
// Install CoCoL as a Cake Addin #addin nuget:?package=CoCoL&version=1.8.1 // Install CoCoL as a Cake Tool #tool nuget:?package=CoCoL&version=1.8.1
CoCoL is a fresh multi-programming approach, leveraging the C# await
keyword to produce sequential and easily understandable multithreading code. With a shared-nothing approach and explicit communication, programs written with CoCoL are automatically free from race conditions and other threading hazards.
If you are familiar with the Go Language, you can think of CoCoL as providing the Go programming model inside the CLR.
Hello World
The most basic program with multithreading would be a producer/consumer setup, where one thread produces data, and another consumes it:
using CoCoL;
class Example
{
static async Task Produce(IChannel<int> channel)
{
foreach (var i in Enumerable.Range(0, 5))
await channel.WriteAsync(i);
channel.Retire();
}
static async Task Consume(IChannel<int> channel)
{
try
{
while (true)
Console.WriteLine("Hello World: {0}", await channel.ReadAsync());
}
catch (RetiredException)
{
}
}
static void Main()
{
var channel = ChannelManager.CreateChannel<int>();
Task.WhenAll(
Produce(channel),
Consume(channel)
).Wait();
}
}
Output:
Hello World: 0
Hello World: 1
Hello World: 2
Hello World: 3
Hello World: 4
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on CoCoL:
Repository | Stars |
---|---|
duplicati/duplicati
Store securely encrypted backups in the cloud!
|
Version | Downloads | Last updated |
---|---|---|
1.8.1 | 63 | 11/12/2024 |
1.8.0 | 6,756 | 5/30/2024 |
1.7.1 | 32,523 | 9/20/2019 |
1.7.0 | 1,617 | 9/10/2019 |
1.6.2 | 2,227 | 9/3/2019 |
1.6.1 | 5,516 | 4/13/2018 |
1.6.0 | 1,224 | 1/23/2018 |
1.5.1 | 31,605 | 9/20/2017 |
1.5.0 | 6,479 | 4/10/2016 |
1.4.9 | 1,120 | 4/8/2016 |
1.4.7 | 1,121 | 4/6/2016 |
1.4.6 | 1,118 | 4/1/2016 |
1.4.5 | 1,111 | 4/1/2016 |
1.4.1 | 1,152 | 3/17/2016 |
1.4.0 | 1,254 | 2/20/2016 |
1.3.1 | 1,178 | 12/23/2015 |
1.3.0 | 1,181 | 12/22/2015 |
1.2.2 | 1,145 | 12/21/2015 |
1.2.1 | 1,172 | 12/20/2015 |
1.2.0 | 1,138 | 12/19/2015 |
1.1.0 | 1,165 | 12/17/2015 |
1.0.0 | 1,323 | 6/10/2015 |
Removed Mono support.