anchor.diff:          try
               if (x.IsTerminated) then
                   Logger.LogF( LogLevel.MildVerbose, (fun _ -> sprintf "ThreadPool Function Work item %A terminates" (infoFunc(tpKey))))
  +                x.ProcWaitHandle <- null
  +                x.InProcessing <- false
                   closeAction()
                   // no more running on thread pool
                   SharedComponentState.Remove(x.CompBase.ComponentId, x.CompBase.SharedStateObj) |> ignore
  -                x.ProcWaitHandle <- null
  -                x.InProcessing <- false
                   (null, true)
               else if (Utils.IsNotNull !item) then
                   // continue to process remaining work item
  
positive.code:         x.Terminate()
          x.SelfClose()
          // if waiting for event, set it
          // make sure we exit Process at least once after setting "IsTerminated" to true
          let oldCount = procCount
          while (x.InProcessing && oldCount = procCount) do
              Thread.Sleep(10)
  
negative.code:                     (eventProc, false)
                  else if (isClosed()) then
                      Logger.LogF( LogLevel.MildVerbose, (fun _ -> sprintf "ThreadPool Function Work item %A terminates" (infoFunc(tpKey))))
                      x.ProcWaitHandle <- null
                      x.InProcessing <- false
                      closeAction()
                      // no more running on thread pool
                      SharedComponentState.Remove(x.CompBase.ComponentId, x.CompBase.SharedStateObj) |> ignore
                      (null, true)
                  else
                      x.ProcWaitHandle <- eventDQ
  