title: Events with Task Parallel Library
body: <p>I'm using the .NET 4.0's Task Parallel Library for executing a long running task. The long running task has different stages and at each stage it completes I want to log some information to a text file or db. Instead of calling the log methods at every stage I thought of using a publisher/subscriber pattern i.e at every stage some event has to fired from the long running task and some other class has to listen to those events and log the appropriate information from the event object. </p>
  
  <p>I'm not very clear about using events in multi-threaded environment. Is it a good idea to use events in TPL and how I can do that? looking for some suggestions..</p>