dwsIOCPWorkerThreadPool.pas FLock.BeginRead in finally section ?

Issue #250 resolved
Adrian Veith created an issue

I just scrolled through the code and this line in the finally section dropped in my eyes

procedure TIOCPTask.Cancel;
var
   tmp : TArray<IWorkerTask>;
begin
   if Status = tsCanceled then Exit;
   FLock.BeginRead;
   try
      tmp := Copy(FDependsTo, 0);
      if FWaitEvent <> 0 then
         SetEvent(FWaitEvent);
   finally
      FLock.BeginRead;         // <------------------ shouldn't this FLock.EndRead; ?
   end;
   for var i := 0 to High(tmp) do
      tmp[i].Cancel;
end;

Comments (1)

  1. Log in to comment