  THeoRTNZapisObjMatThread = class(TThread)
   private
    FMainService: TService;
    FDataMod : TdatMod;
    FLock: TCriticalSection;
    FTermEvent: TEvent;
    FRunning: boolean;
    FTimer: THandle;
   protected
    procedure Execute; override;
    procedure TerminatedSet; override; // XE2+ only *
   public
    constructor Create (AOnTerminate: TNotifyEvent; AService: TService=nil; dm: TdatMod = nil);
    destructor  Destroy; override;
    procedure ThreadTerminate;
  end;
