huangyingwen / retlang

Automatically exported from code.google.com/p/retlang
0 stars 0 forks source link

This is a fork from http://code.google.com/p/retlang/ Currently it's a (crude) adaption to be compatible with portable class library for use e.g. in Windows Phone.

Retlang is a high performance C# threading library (see Jetlang for a version in Java). The library is intended for use in message based concurrency similar to event based actors in Scala. The library does not provide remote messaging capabilities. It is designed specifically for high performance in-memory messaging.

Features

All messages to a particular IFiber are delivered sequentially. Components can easily keep state without synchronizing data access or worrying about thread races.

Retlang relies upon four abstractions: IFiber, IQueue, IExecutor, and IChannel. An IFiber is an abstraction for the context of execution (in most cases a thread). An IQueue is an abstraction for the data structure that holds the actions until the IFiber is ready for more actions. The default implementation, DefaultQueue, is an unbounded storage that uses standard locking to notify when it has actions to execute. An IExecutor performs the actual execution. It is useful as an injection point to achieve fault tolerance, performance profiling, etc. The default implementation, DefaultExecutor, simply executes actions. An IChannel is an abstraction for the conduit through which two or more IFibers communicate (pass messages).

Quick Start

Fibers

Four implementations of IFibers are included in Retlang.

Channels

The main IChannel included in Retlang is simply called Channel. Below are the main types of subscriptions.

Further documentation can be found baked-in, in the unit tests, in the user group, or visually here (courtesy of Mike Roberts).