Install-Package Zds.Flow -Version 0.1.3
dotnet add package Zds.Flow --version 0.1.3
<PackageReference Include="Zds.Flow" Version="0.1.3" />
paket add Zds.Flow --version 0.1.3
#r "nuget: Zds.Flow, 0.1.3"
// Install Zds.Flow as a Cake Addin #addin nuget:?package=Zds.Flow&version=0.1.3 // Install Zds.Flow as a Cake Tool #tool nuget:?package=Zds.Flow&version=0.1.3
A library to control the flow of program is a completely different way. This library can be used as partial replacement of old Asynchronous system in .Net.
You can design applications with massive parallelism without dealing with thread safety. You can create applications completely detached from UI. You can easily and safely interact with it.
There are four major namespaces in library:
- Updaters (Objects that create threads, Acts as ThreadPool)
- Updatables (Objects that use threads created by Updaters)
- Collections (Contains different Thread Safe/Unsafe collections)
- Machinery (Used to design a graph that controls the flow of objects)
Things to Remember
- Every objects that implements
IStartStopableinterface will not work unless you
Startit. Every Updater/Updatable object implements
IStartStopableinterface. So you have to start them manually. You can stop them by calling
Stop. You can check object status by using
Updatableobject will never work without an
Updater. By default there is a global
Updaterthat is assigned to
Updateris not given. You can assign an
Updater.Add(). You can get all
Updatablesassigned to an
- A thread safe collection has prefix
Safein its name. So be careful when using collections in Asynchronous objects or in a
- Objects that have managed/unmanaged resources implement
IDisposable. You can check if an object is disposed by calling
- Objects that throw exceptions implement
IThrowsExceptioninterface. These objects have event
OnException. You can use this event to keep track of exceptions. You can even create an
ExceptionHandlerand add your
IThrowsExceptionobject to it.
Updatables are objects that implement
IUpdatable. These objects have method
Update() that is recursively called by an
Updater assigned to it. It is not fixed how fast or delayed the method will be called. So, it should be handled by
Every object in
Updatable namespace has at least one overridable object that can be overridden to define the behaviour of object. You can also do it by passing pointer of a method of same signature through constructor to define behaviour. You can also use associated event. So, inheritance is not MUST.
Here is the list of all
Updatables and their functionalities.
All objects in
Machinery namespace implement
Sink is like a function that takes an input and behaves on the basis of input.
ISink<T> has method
Send(T obj) that lets any code send an object to sink. A
Sink can also send object to other
Sink and can make an execution graph. All objects in
Machinery inherit classes from
Updatables. They combine functionality of
Updatable. Updatable behaviour allows it to execute parallel, (independent of sender), while
Sink allows functionality to receive objects or batch of objects.
- No dependencies.
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.