Tpl Dataflow (IDataflowBlock) – Part 5

Monday, December 19, 2011

Tpl Dataflow (IDataflowBlock ) - Part 5 the previous post discus the concept ITargetBlock and ISourceBlock, which is the TDF consumer/Producer contract. you can find all the post in this series under the TDF tag. this post focus on the IDataflowBlock contract which is the life-time management contract for all data-flow's blocks. the IDataflowBlock define single property and 2 methods: Code Snippet public interface IDataflowBlock {     Task Completion { get; }       void Complete();     void Fault(Exception exception); } ...

Task != Thread

Sunday, December 18, 2011

Task != Thread whenever I teaching the Tpl Task subject I continually repeating the mantra which say that "task is a metadata/context of execution and it does not really responsible for the actual execution". Task is a data structure which hold information about code execution, it's hold the delegate which will be execute, status, state, result, exception synchronization object, ext... but the responsibility of the execution is actually belong to the Task Scheduler. in matter of fact task can be execute synchronously. Code Snippet Console.WriteLine(Thread.CurrentThread.ManagedThreadId); Task...