1 | /* -*- C++ -*- |
2 | This file declares the ShuttingDownState class. |
3 | |
4 | SPDX-FileCopyrightText: 2005-2013 Mirko Boehm <mirko@kde.org> |
5 | |
6 | SPDX-License-Identifier: LGPL-2.0-or-later |
7 | |
8 | $Id: ShuttingDownState.h 32 2005-08-17 08:38:01Z mirko $ |
9 | */ |
10 | |
11 | #ifndef ShuttingDownState_H |
12 | #define ShuttingDownState_H |
13 | |
14 | #include "weaverimplstate.h" |
15 | |
16 | namespace ThreadWeaver |
17 | { |
18 | class Queue; |
19 | |
20 | /** ShuttingDownState is enabled when the Weaver destructor is entered. It |
21 | * prevents threads from still accessing queue management methods, and new jobs being queued. |
22 | */ |
23 | class ShuttingDownState : public WeaverImplState |
24 | { |
25 | public: |
26 | explicit ShuttingDownState(QueueSignals *weaver); |
27 | |
28 | /** Shut down the queue. */ |
29 | void shutDown() override; |
30 | /** Suspend job processing. */ |
31 | void suspend() override; |
32 | /** Resume job processing. */ |
33 | void resume() override; |
34 | /** Assign a job to an idle thread. */ |
35 | JobPointer applyForWork(Thread *th, bool wasBusy) override; |
36 | /** Wait (by suspending the calling thread) until a job becomes available. */ |
37 | void waitForAvailableJob(Thread *th) override; |
38 | /** reimpl */ |
39 | StateId stateId() const override; |
40 | }; |
41 | |
42 | } |
43 | |
44 | #endif // ShuttingDownState_H |
45 | |