   if Assigned(empVytezovaniDokThr) then
    begin
{$IFDEF DEBUG}
     WriteLn ('Ukoncuji vlakno EMP vytezovani dokumentu...');
{$ENDIF}
     datMod.LogInfo (Quick.Logger.etInfo, 'Ukoncuji vlakno EMP vytezovani dokumentu...');
     try
       empVytezovaniDokThr.ThreadTerminate;
       FreeAndNil(empVytezovaniDokThr);
      except on E:Exception do
// add event in eventlog with reason why the service couldn't stop
       LogMessage('Cannot stop thread EMPVytezaniDok: ' + E.Message, EVENTLOG_ERROR_TYPE, 0, 1);
     end;
     datMod.LogInfo (Quick.Logger.etInfo, '  OK');
{$IFDEF DEBUG}
     WriteLn ('  OK');
{$ENDIF}
    end;
