CoCoL 1.8.1

dotnet add package CoCoL --version 1.8.1                
NuGet\Install-Package CoCoL -Version 1.8.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CoCoL" Version="1.8.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CoCoL --version 1.8.1                
#r "nuget: CoCoL, 1.8.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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 850 11/12/2024
1.8.0 8,319 5/30/2024
1.7.1 34,894 9/20/2019
1.7.0 1,626 9/10/2019
1.6.2 2,234 9/3/2019
1.6.1 5,530 4/13/2018
1.6.0 1,236 1/23/2018
1.5.1 31,618 9/20/2017
1.5.0 6,490 4/10/2016
1.4.9 1,131 4/8/2016
1.4.7 1,134 4/6/2016
1.4.6 1,129 4/1/2016
1.4.5 1,122 4/1/2016
1.4.1 1,163 3/17/2016
1.4.0 1,267 2/20/2016
1.3.1 1,189 12/23/2015
1.3.0 1,192 12/22/2015
1.2.2 1,156 12/21/2015
1.2.1 1,185 12/20/2015
1.2.0 1,149 12/19/2015
1.1.0 1,176 12/17/2015
1.0.0 1,338 6/10/2015

Removed Mono support.