anchor.diff:  function TPCDaemon.ShutDown: Boolean;
   begin
     Result:=inherited ShutDown;
  -  TLog.NewLog(ltinfo,ClassName,'Daemon Shutdown: '+BoolToStr(Result));
  +  TLog.NewLog(ltinfo,ClassName,'Daemon Shutdown Start');
     FThread.Terminate;
  +  FThread.WaitFor;
  +  TLog.NewLog(ltinfo,ClassName,'Daemon Shutdown Finished');
   end;
   
   function TPCDaemon.Install: Boolean;
  
positive.code: 
  { TPCDaemon }
  
  procedure TPCDaemon.ThreadStopped(Sender: TObject);
  begin
    FreeAndNil(FThread);
  end;
  
  function TPCDaemon.Start: Boolean;
  begin
    Result:=inherited Start;
    TLog.NewLog(ltinfo,ClassName,'Daemon Start '+BoolToStr(Result));
    FThread:=TPCDaemonThread.Create;
    FThread.OnTerminate:=@ThreadStopped;
    FThread.FreeOnTerminate:=False;
    if (Application.HasOption('b','block')) then begin
      FThread.MaxBlockToRead:=StrToInt64Def(Application.GetOptionValue('b','block'),$FFFFFFFF);
      TLog.NewLog(ltinfo,ClassName,'Max block to read: '+IntToStr(FThread.MaxBlockToRead));
    end;
    FThread.Resume;
  end;
  
  function TPCDaemon.Stop: Boolean;
  begin
    Result:=inherited Stop;
    TLog.NewLog(ltinfo,ClassName,'Daemon Stop: '+BoolToStr(Result));
    FThread.Terminate;
  end;
  
  function TPCDaemon.Pause: Boolean;
  
negative.code: 
  procedure TPCDaemonMapper.DoOnDestroy;
  begin
    inherited DoOnDestroy;
    If Assigned(FLog) then begin
      FLog.OnInThreadNewLog:=Nil;
      FreeAndNil(FLog);
    end;
  end;
  
  end.
  