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 | /* |
21 | * ShuttingDownState is enabled when the Weaver destructor is entered. It |
22 | * prevents threads from still accessing queue management methods, and new jobs being queued. |
23 | */ |
24 | class ShuttingDownState : public WeaverImplState |
25 | { |
26 | public: |
27 | explicit ShuttingDownState(QueueSignals *weaver); |
28 | |
29 | /* Shut down the queue. */ |
30 | void shutDown() override; |
31 | /* Suspend job processing. */ |
32 | void suspend() override; |
33 | /* Resume job processing. */ |
34 | void resume() override; |
35 | /* Assign a job to an idle thread. */ |
36 | JobPointer applyForWork(Thread *th, bool wasBusy) override; |
37 | /* Wait (by suspending the calling thread) until a job becomes available. */ |
38 | void waitForAvailableJob(Thread *th) override; |
39 | /* reimpl */ |
40 | StateId stateId() const override; |
41 | }; |
42 | |
43 | } |
44 | |
45 | #endif // ShuttingDownState_H |
46 | |