You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`
function TdwsXTimerQueue.Add(const AInterval: Cardinal; AEvent : TTimerEvent; const AOnTimer: TWaitOrTimerCallback): THandle;
var
Handle : THandle;
Timer : TdwsXTimer;
Event : epoll_event;
begin
Result := INVALID_HANDLE_VALUE;
Handle := timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK);
if Handle <> THandle(-1) then
begin
Timer := TdwsXTimer.Create;
Timer.Handle := Handle;
Timer.Interval := AInterval;
Timer.OnTimer := AOnTimer;
Timer.Event := AEvent;
Event.data.ptr := Timer;
Event.events := EPOLLIN or EPOLLET;
if epoll_ctl(_TimerQueuePool.Handle, EPOLL_CTL_ADD, Handle, @Event) <> -1 then
begin
if _SetInterval(Handle, AInterval) then
begin
_TimersLock.Enter;
try
_Timers.Add(Handle, Timer);
finally
_TimersLock.Leave;
end;
Result := Handle;
end else Timer.Free; //if _SetInterval return false then the Timer in the EPOLL will be invalid
end else
begin
__close(Handle);
Timer.Free;
end;
I have mentioned the problem about Timer( May be nil).
The more serious problem is the Timer maybe a invalid value but not nil.
The text was updated successfully, but these errors were encountered: