1
1
{ ***************************************************************************
2
2
3
- Copyright (c) 2016-2019 Kike Pérez
3
+ Copyright (c) 2016-2020 Kike Pérez
4
4
5
5
Unit : Quick.Threads
6
6
Description : Thread safe collections
7
7
Author : Kike Pérez
8
8
Version : 1.5
9
9
Created : 09/03/2018
10
- Modified : 02/12/2019
10
+ Modified : 27/06/2020
11
11
12
12
This file is part of QuickLib: https://github.com/exilon/QuickLib
13
13
@@ -265,8 +265,10 @@ ETaskSchedulerError = class(Exception);
265
265
IWorkTask = interface (ITask)
266
266
function OnInitialize (aTaskProc : TTaskProc) : IWorkTask;
267
267
function OnException (aTaskProc : TTaskExceptionProc) : IWorkTask;
268
+ function OnException_Sync (aTaskProc : TTaskExceptionProc) : IWorkTask;
268
269
function OnRetry (aTaskProc : TTaskRetryProc) : IWorkTask;
269
270
function OnTerminated (aTaskProc : TTaskProc) : IWorkTask;
271
+ function OnTerminated_Sync (aTaskProc : TTaskProc) : IWorkTask;
270
272
function Retry (aMaxRetries : Integer) : IWorkTask;
271
273
function RetryForever : IWorkTask;
272
274
function WaitAndRetry (aMaxRetries, aWaitTimeBetweenRetriesMS : Integer) : IWorkTask; overload;
@@ -385,7 +387,9 @@ TWorkTask = class(TTask,IWorkTask)
385
387
public
386
388
function OnInitialize (aTaskProc : TTaskProc) : IWorkTask;
387
389
function OnException (aTaskProc : TTaskExceptionProc) : IWorkTask; virtual ;
390
+ function OnException_Sync (aTaskProc : TTaskExceptionProc) : IWorkTask; virtual ;
388
391
function OnTerminated (aTaskProc : TTaskProc) : IWorkTask; virtual ;
392
+ function OnTerminated_Sync (aTaskProc : TTaskProc) : IWorkTask; virtual ;
389
393
function OnRetry (aTaskProc : TTaskRetryProc) : IWorkTask; virtual ;
390
394
function Retry (aMaxRetries : Integer) : IWorkTask;
391
395
function RetryForever : IWorkTask;
@@ -1346,6 +1350,12 @@ function TWorkTask.OnException(aTaskProc : TTaskExceptionProc) : IWorkTask;
1346
1350
Result := Self;
1347
1351
end ;
1348
1352
1353
+ function TWorkTask.OnException_Sync (aTaskProc: TTaskExceptionProc): IWorkTask;
1354
+ begin
1355
+ fExceptionWithSync := True;
1356
+ Result := OnException(aTaskProc);
1357
+ end ;
1358
+
1349
1359
function TWorkTask.OnInitialize (aTaskProc: TTaskProc): IWorkTask;
1350
1360
begin
1351
1361
fInitializeProc := aTaskProc;
@@ -1364,6 +1374,12 @@ function TWorkTask.OnTerminated(aTaskProc: TTaskProc): IWorkTask;
1364
1374
Result := Self;
1365
1375
end ;
1366
1376
1377
+ function TWorkTask.OnTerminated_Sync (aTaskProc: TTaskProc): IWorkTask;
1378
+ begin
1379
+ fTerminateWithSync := True;
1380
+ Result := OnTerminated(aTaskProc);
1381
+ end ;
1382
+
1367
1383
procedure TWorkTask.Run ;
1368
1384
begin
1369
1385
fEnabled := True;
0 commit comments