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.
<PackageVersion Include="CoCoL" Version="1.8.1" />
                    
Directory.Packages.props
<PackageReference Include="CoCoL" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version 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.
#addin nuget:?package=CoCoL&version=1.8.1
                    
Install CoCoL as a Cake Addin
#tool nuget:?package=CoCoL&version=1.8.1
                    
Install CoCoL as a Cake Tool

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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.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 4,635 11/12/2024
1.8.0 9,142 5/30/2024
1.7.1 39,636 9/20/2019
1.7.0 1,652 9/10/2019
1.6.2 2,258 9/3/2019
1.6.1 5,639 4/13/2018
1.6.0 1,348 1/23/2018
1.5.1 31,691 9/20/2017
1.5.0 6,566 4/10/2016
1.4.9 1,206 4/8/2016
1.4.7 1,211 4/6/2016
1.4.6 1,204 4/1/2016
1.4.5 1,204 4/1/2016
1.4.1 1,239 3/17/2016
1.4.0 1,343 2/20/2016
1.3.1 1,266 12/23/2015
1.3.0 1,269 12/22/2015
1.2.2 1,234 12/21/2015
1.2.1 1,262 12/20/2015
1.2.0 1,225 12/19/2015
1.1.0 1,252 12/17/2015
1.0.0 1,416 6/10/2015

Removed Mono support.