Skip to content

Commit

Permalink
Merge pull request exilon#55 from turric4n/master
Browse files Browse the repository at this point in the history
[QuickThreads] >> ITask <-> TTask >> Added Enable Disable methods.
  • Loading branch information
exilon authored Nov 15, 2020
2 parents 0332033 + ec81447 commit e6f3f15
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Quick.Threads.pas
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ ETaskSchedulerError = class(Exception);
procedure DoExecute;
procedure DoException(aException : Exception);
procedure DoTerminate;
procedure Enable;
procedure Disable;
{$IFNDEF FPC}
property Param[index : Integer] : TFlexValue read GetParam write SetParam; default;
property Param[const Name : string] : TFlexValue read GetParam write SetParam; default;
Expand Down Expand Up @@ -381,6 +383,8 @@ TTask = class(TInterfacedObject,ITask)
function MaxRetries : Integer;
function LastException : Exception;
function CircuitBreaked : Boolean;
procedure Disable;
procedure Enable;
end;

TWorkTask = class(TTask,IWorkTask)
Expand Down Expand Up @@ -1133,6 +1137,11 @@ destructor TTask.Destroy;
inherited;
end;

procedure TTask.Disable;
begin
fEnabled := False;
end;

procedure TTask.DoException(aException : Exception);
begin
fTaskStatus := TWorkTaskStatus.wtsException;
Expand Down Expand Up @@ -1221,6 +1230,11 @@ procedure TTask.DoTerminate;
if Assigned(fTerminateProc) then fTerminateProc(Self);
end;

procedure TTask.Enable;
begin
fEnabled := True;
end;

function TTask.GetIdTask: Int64;
begin
Result := fIdTask;
Expand Down

0 comments on commit e6f3f15

Please sign in to comment.