diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 16:48:05 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 16:48:05 +0200 |
commit | e7ceb20f1d6497f28054dc111260be8ba8d8b5aa (patch) | |
tree | 0d21c616743626435afd9e14922a27c45ceba772 /library/multithreading.h | |
parent | 1.4 (diff) | |
download | FreeFileSync-e7ceb20f1d6497f28054dc111260be8ba8d8b5aa.tar.gz FreeFileSync-e7ceb20f1d6497f28054dc111260be8ba8d8b5aa.tar.bz2 FreeFileSync-e7ceb20f1d6497f28054dc111260be8ba8d8b5aa.zip |
1.5
Diffstat (limited to 'library/multithreading.h')
-rw-r--r-- | library/multithreading.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/library/multithreading.h b/library/multithreading.h index 8466bb01..b8481a0f 100644 --- a/library/multithreading.h +++ b/library/multithreading.h @@ -9,22 +9,24 @@ class StatusUpdater { public: - StatusUpdater() : abortionRequested(false) {} + StatusUpdater() : + abortionRequested(false) {} virtual ~StatusUpdater() {} //these four methods have to be implemented in the derived classes to handle error and status information virtual void updateStatusText(const wxString& text) = 0; virtual void initNewProcess(int objectsTotal, double dataTotal, int processID) = 0; //informs about the total amount of data that will be processed from now on - virtual void updateProcessedData(int objectsProcessed, double dataProcessed) = 0; //called periodically after data was processed + virtual void updateProcessedData(int objectsProcessed, double dataProcessed) = 0; //called periodically after data was processed virtual int reportError(const wxString& text) = 0; //this method is triggered repeatedly and can be used to refresh the ui by dispatching pending events - virtual void triggerUI_Refresh() {} + virtual void triggerUI_Refresh() = 0; - void requestAbortion() //opportunity to abort must be implemented in the three virtual status and error methods (for example in triggerUI_Refresh()) + void requestAbortion() //opportunity to abort must be implemented in a frequently executed method like triggerUI_Refresh() { //currently used by the UI status information screen, when button "Abort is pressed" abortionRequested = true; } + static const int continueNext = -1; static const int retry = -2; @@ -48,11 +50,11 @@ public: virtual ~UpdateWhileExecuting(); void waitUntilReady(); - void execAndUpdate(StatusUpdater* statusUpdater); + void execute(StatusUpdater* statusUpdater); private: - //implement a longrunning method without dependencies (e.g. copy file function) returning "true" on success + //implement a longrunning method without dependencies (e.g. copy file function); share input/output parameters as instance variables virtual void longRunner() = 0; WorkerThread* theWorkerThread; |