|
@@ -20,6 +20,9 @@ procedure CoverWorkerEnqueueBookIfMissing(B: TBook);
|
|
|
queue is empty. Call again later to restart if you enqueue more books. }
|
|
queue is empty. Call again later to restart if you enqueue more books. }
|
|
|
procedure CoverWorkerStart;
|
|
procedure CoverWorkerStart;
|
|
|
|
|
|
|
|
|
|
+{ Stops the background worker and clears any pending books }
|
|
|
|
|
+procedure CoverWorkerStop;
|
|
|
|
|
+
|
|
|
implementation
|
|
implementation
|
|
|
|
|
|
|
|
type
|
|
type
|
|
@@ -179,6 +182,28 @@ begin
|
|
|
end;
|
|
end;
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
+{ Stops the worker and clears any queued books }
|
|
|
|
|
+procedure CoverWorkerStop;
|
|
|
|
|
+var
|
|
|
|
|
+ l: TList;
|
|
|
|
|
+begin
|
|
|
|
|
+ if GWorker <> nil then
|
|
|
|
|
+ begin
|
|
|
|
|
+ GWorker.Terminate;
|
|
|
|
|
+ GWorker.WaitFor;
|
|
|
|
|
+ GWorker := nil;
|
|
|
|
|
+ end;
|
|
|
|
|
+ if GPdfQueue <> nil then
|
|
|
|
|
+ begin
|
|
|
|
|
+ l := GPdfQueue.LockList;
|
|
|
|
|
+ try
|
|
|
|
|
+ l.Clear;
|
|
|
|
|
+ finally
|
|
|
|
|
+ GPdfQueue.UnlockList;
|
|
|
|
|
+ end;
|
|
|
|
|
+ end;
|
|
|
|
|
+end;
|
|
|
|
|
+
|
|
|
{--- worker --------------------------------------------------------------------}
|
|
{--- worker --------------------------------------------------------------------}
|
|
|
|
|
|
|
|
procedure TCoverWorker.DoApplyCover;
|
|
procedure TCoverWorker.DoApplyCover;
|