Zds.Flow 0.1.3

dotnet add package Zds.Flow --version 0.1.3
NuGet\Install-Package Zds.Flow -Version 0.1.3
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="Zds.Flow" Version="0.1.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Zds.Flow --version 0.1.3
#r "nuget: Zds.Flow, 0.1.3"
#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 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

Zds.Flow

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

  1. Every objects that implements IStartStopable interface will not work unless you Start it. Every Updater/Updatable object implements IStartStopable interface. So you have to start them manually. You can stop them by calling Stop. You can check object status by using IStartStopable.IsRunning property.
  2. An Updatable object will never work without an Updater. By default there is a global Updater that is assigned to Updatable if Updater is not given. You can assign an Updater to an Updateable by setting Updatable.Updater or calling Updater.Add(). You can get all Updatables assigned to an Updater by using Updater.Targets property.
  3. A thread safe collection has prefix Safe in its name. So be careful when using collections in Asynchronous objects or in a Machinery.
  4. Objects that have managed/unmanaged resources implement IDisposable. You can check if an object is disposed by calling *.IsDisposed.
  5. Objects that throw exceptions implement IThrowsException interface. These objects have event OnException. You can use this event to keep track of exceptions. You can even create an ExceptionHandler and add your IThrowsException object to it.

Updatables

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 Updatable. All Updatables implement IDisposable IThrowsException and IStartStopable.

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.

Updatables Functionality
Updatable Its method OnUpdated is called recursively. OnUpdated is an overridable method. You can inherit the object to define what to do. You can also define what to do by passing pointer to method matching the signature of OnUpdated or using PreUpdate or PostUpdate events. PreUpdate is called before OnUpdated is called and PostUpdate is called after OnUpdated is called.
SyncObject Inherits Updatable and overrides method OnUpdated. Its method SyncUpdate is called recursively such that only one thread is in SyncUpdate method at a time. You can get lock by using Lock property.
AsyncObject Inherits Updatable and overrides method OnUpdated. Its method AsyncUpdate is recursively called by unspecific number of threads. That number depends on multiple factors e.g Updater. The number of threads will not exceed MaxThread property of AsyncObject. You can get total threads currently stuck in AsyncUpdate by using ActiveThreads property.
SyncTimer Inherits SyncObject and overrides method SyncUpdate. Its method Tick is called periodically after SyncTimer.Delay time such that only one thread is in Tick method. Next tick time does not depend on previous tick time but you can make timer tolerant by enabling SyncTimer.IsTolerant. In each tick timer calculates error (difference between actual tick time and expected tick time), if SyncTimer.ErrorCorrection is enabled this time will be subtracted from next tick time of timer. You can force a Tick at any instance by calling SyncTimer.TickNow().
AsyncTimer Inherits AsyncObject and overrides method AsyncUpdate method. Its method Tick is called periodically after AsyncTimer.Delay time by unspecific number of threads. Next tick time does not depend on previous tick time but you can make timer tolerant by enabling AsyncTimer.IsTolerant. In each tick timer calculates error (difference between actual tick time and expected tick time), if AsyncTimer.ErrorCorrection is enabled this time will be subtracted from next tick time of timer. You can force a Tick at any instance by calling AsyncTimer.TickNow().

Machinery

All objects in Machinery namespace implement ISink. A 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 Sink and Updatable. Updatable behaviour allows it to execute parallel, (independent of sender), while Sink allows functionality to receive objects or batch of objects.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.1.3 481 2/5/2020
0.1.2 448 12/9/2019
0.1.1 434 12/9/2019
0.1.0 488 12/9/2019