Ver código fonte

Merge pull request #55 from turric4n/master

[QuickThreads] >> ITask <-> TTask >> Added Enable Disable methods.
Exilon 4 anos atrás
pai
commit
e6f3f15ab1
1 arquivos alterados com 14 adições e 0 exclusões
  1. 14 0
      Quick.Threads.pas

+ 14 - 0
Quick.Threads.pas

@@ -233,6 +233,8 @@ type
     procedure DoExecute;
     procedure DoExecute;
     procedure DoException(aException : Exception);
     procedure DoException(aException : Exception);
     procedure DoTerminate;
     procedure DoTerminate;
+    procedure Enable;
+    procedure Disable;
     {$IFNDEF FPC}
     {$IFNDEF FPC}
     property Param[index : Integer] : TFlexValue read GetParam write SetParam; default;
     property Param[index : Integer] : TFlexValue read GetParam write SetParam; default;
     property Param[const Name : string] : TFlexValue read GetParam write SetParam; default;
     property Param[const Name : string] : TFlexValue read GetParam write SetParam; default;
@@ -381,6 +383,8 @@ type
     function MaxRetries : Integer;
     function MaxRetries : Integer;
     function LastException : Exception;
     function LastException : Exception;
     function CircuitBreaked : Boolean;
     function CircuitBreaked : Boolean;
+    procedure Disable;
+    procedure Enable;
   end;
   end;
 
 
   TWorkTask = class(TTask,IWorkTask)
   TWorkTask = class(TTask,IWorkTask)
@@ -1133,6 +1137,11 @@ begin
   inherited;
   inherited;
 end;
 end;
 
 
+procedure TTask.Disable;
+begin
+  fEnabled := False;
+end;
+
 procedure TTask.DoException(aException : Exception);
 procedure TTask.DoException(aException : Exception);
 begin
 begin
   fTaskStatus := TWorkTaskStatus.wtsException;
   fTaskStatus := TWorkTaskStatus.wtsException;
@@ -1221,6 +1230,11 @@ begin
   if Assigned(fTerminateProc) then fTerminateProc(Self);
   if Assigned(fTerminateProc) then fTerminateProc(Self);
 end;
 end;
 
 
+procedure TTask.Enable;
+begin
+  fEnabled := True;
+end;
+
 function TTask.GetIdTask: Int64;
 function TTask.GetIdTask: Int64;
 begin
 begin
   Result := fIdTask;
   Result := fIdTask;