SmellyContinuation (Task Scheduler)

This project was a result of another quick Spike I did for a personal project surrounding a highly concurrent product with lots of dedicated long-running threads. This is a simple demonstration of the Erlang Continuation Pattern in .NET.

Implementing this is pretty easy... Here is a quick walk-through:

1. Download the source code (SmellyContinuation.zip (17.33 kb)) and compile the solution

2. In the consuming application, add a reference to "Smelser.Continuation.dll"

3. Import the namespace into the consuming class file

using Smelser.Continuation;

Create Continuable Tasks and Start Continuation

4. This is a simple matter of implementing either of the "IContinuableTask" or "IOneTimeTask" interfaces. There are a few samples in the download package to get you started

5. Create an instance of the Task Scheduler and schedule each task

var tasksToSchedule = new IContinuableTask[]
{
    new EvenConsoleTask(),
    new OddConsoleTask(),
    new OneTimeTask()
};
var scheduler = new TaskScheduler();
scheduler.RegisterContinuableTasks(tasksToSchedule);
scheduler.Start();

6. Start the scheduler to initiate continuation processes 

scheduler.Start();

That's it...