Hi every one.
I am using RTLEventWaitFor(RTLEvent, FTimeOut) to implement a custom timer. I am using the TThread.Synchronize as the OnTimer event, similar to the wiki example. My current Execute procedure is:
procedure TMyThread.Execute;
begin
while not Terminated do
if Enabled then
begin
RTLeventWaitFor(FRTLEvent, FTimeOut);
Synchronize(@ClockOnTimer);
end
else RTLeventWaitFor(FRTLEvent);
end;
Right now, I am trying to implement a Reset functionality. So, would be possible to reset the rtleventwaitfor time directly after its execution? What do you think about this ideia??
Edit.:
What I was looking for was a way to override the WaitFor TimeOut during the RTLeventWaitFor execution/waiting.
Seems that it is not possible. At least with my current knowledge
See my current solution:
procedure TClockThread.Reset;
begin
if not FMustReset then
begin
FMustReset := True;
RTLeventSetEvent(FRTLEvent);
end
end;
procedure TClockThread.ClockOnTimer;
begin
if not Enabled then Exit;
if FMustReset then
begin
FMustReset := False;
Exit;
end;
if Assigned(FOnTimer) then FOnTimer(Self);
end;