1/* -*- C++ -*-
2 This file implements the SuspendingState 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: SuspendingState.cpp 30 2005-08-16 16:16:04Z mirko $
9*/
10
11#include "suspendingstate.h"
12
13#include "state.h"
14#include "threadweaver.h"
15
16namespace ThreadWeaver
17{
18SuspendingState::SuspendingState(Weaver *weaver)
19 : WeaverImplState(weaver)
20{
21}
22
23void SuspendingState::suspend()
24{
25 // this request is not handled in Suspending state (we are already suspending...)
26}
27
28void SuspendingState::resume()
29{
30 weaver()->setState(WorkingHard);
31}
32
33void SuspendingState::activated()
34{
35 weaver()->reschedule();
36}
37
38JobPointer SuspendingState::applyForWork(Thread *th, bool wasBusy)
39{
40 weaver()->takeFirstAvailableJobOrSuspendOrWait(th, threadWasBusy: wasBusy, suspendIfAllThreadsInactive: true, justReturning: true);
41 weaver()->waitForAvailableJob(th);
42 return weaver()->applyForWork(thread: th, wasBusy: false);
43}
44
45StateId SuspendingState::stateId() const
46{
47 return Suspending;
48}
49
50}
51

source code of threadweaver/src/suspendingstate.cpp