1/* -*- C++ -*-
2 This file implements the SuspendedState 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: SuspendedState.cpp 30 2005-08-16 16:16:04Z mirko $
9*/
10
11#include "suspendedstate.h"
12
13#include "threadweaver.h"
14
15namespace ThreadWeaver
16{
17SuspendedState::SuspendedState(Weaver *weaver)
18 : WeaverImplState(weaver)
19{
20}
21
22void SuspendedState::suspend()
23{
24 // this request is not handled in Suspended state
25}
26
27void SuspendedState::resume()
28{
29 weaver()->setState(WorkingHard);
30}
31
32JobPointer SuspendedState::applyForWork(Thread *th, bool wasBusy)
33{
34 // suspend all threads in case they wake up:
35 Q_ASSERT(wasBusy == 0);
36 weaver()->waitForAvailableJob(th);
37 return weaver()->applyForWork(thread: th, wasBusy);
38}
39
40StateId SuspendedState::stateId() const
41{
42 return Suspended;
43}
44
45}
46

source code of threadweaver/src/suspendedstate.cpp