title: How to use SmartThreadPool to Cancel-Wait-Kill a workItem?
body: <p>We use .Net 3.5 and C# SmartThreadPool by Ami Bar to manage multiple work items. When our app shuts down we would like to "tell" all work items that they should try to complete their work as soon as possible, then give them a grace period to complete and then kill the ones still running. Our work items are cooperative and they need to be able to check if they were "told" to complete work and get out of long-running loops.</p>
  
  <p>It sounded like a good idea to use workItemResult.Cancel(false) to "tell" work items to complete and then  use SmartThreadPool.IsWorkItemCanceled inside of work items to stop their work, but it turns out that WaitAll does not wait on cancelled items and hence we can't block for the grace period.</p>
  
  <p>I started playing with creating a WorkItemGroup for each work item, call Cancel(false) on work item and then workItemGroup.WorkForIdle(gracePeriod) but wanted to check if this is worth pursuing.</p>
  
  <p>I'd appreciate any thoughts on this.</p>
  
  <p>Thanks</p>