anchor.diff:        FOnShutdown(Self);
   
       if FStatus = lspInitialized then
  -      Request('shutdown', 'null', HandleShutdown)
  -    else
  -      TerminateServer;
  -    repeat
  -      Sleep(0);
  -      CheckSynchronize(100);
  -    until FStatus = lspInactive;
  -  end;
  +    begin
  +      Request('shutdown', 'null', HandleShutdown);
  +      FServerThread.WaitFor;
  +    end;
  +    FreeAndNil(FServerThread);
  +    Assert(FStatus = lspInactive);
  +  end;
  +  // TThread destroy calls Terminate and then WaitFor
     if Assigned(FSendDataThread) then
  -  begin
  -    FSendDataThread.Terminate;
  -    Sleep(0);
  -    FSendDataThread := nil
  -  end;
  +    FreeAndNil(FSendDataThread);
   end;
   
   procedure TLspClient.StartServer;
  
positive.code:   ExCmdOptions: TJclExecuteCmdProcessOptions);
  begin
    inherited Create(True);
    FreeOnTerminate := True;
    FLspClient := LspClient;
    fExCmdOptions := ExCmdOptions;
    fAbortEvent := TJclEvent.Create(nil, True, False, '');
  
negative.code:     RawOutput := True;
      MergeError := False;
      RawError := True;
      BufferSize := 1024*64;
    end;
  end;
  