ThreadWeaver
State.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef THREADWEAVER_STATE_H
00030 #define THREADWEAVER_STATE_H
00031
00032
00033
00034 #include <threadweaver/threadweaver_export.h>
00035
00036 namespace ThreadWeaver {
00037
00038 class Job;
00039 class Thread;
00040 class WeaverInterface;
00041
00048 enum StateId {
00051 InConstruction = 0,
00053 WorkingHard,
00056 Suspending,
00059 Suspended,
00063 ShuttingDown,
00066 Destructed,
00068 NoOfStates
00069 };
00070
00073 class THREADWEAVER_EXPORT State
00074 {
00075 public:
00077 explicit State( WeaverInterface *weaver );
00078
00080 virtual ~State();
00081
00085 QString stateName() const;
00087 virtual StateId stateId() const = 0;
00089 virtual void suspend() = 0;
00091 virtual void resume() = 0;
00096 virtual Job* applyForWork ( Thread *th, Job* previous ) = 0;
00098 virtual void waitForAvailableJob ( Thread *th ) = 0;
00101 virtual void activated();
00102
00103 protected:
00105 WeaverInterface* weaver();
00106
00107 class Private;
00108 Private * const d;
00109 };
00110 }
00111
00112 #endif // THREADWEAVER_STATE_H