ThreadWeaver

suspendingstate.cpp
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, wasBusy, true, true);
41 weaver()->waitForAvailableJob(th);
42 return weaver()->applyForWork(th, false);
43}
44
45StateId SuspendingState::stateId() const
46{
47 return Suspending;
48}
49
50}
Thread represents a worker thread in a Queue's inventory.
Definition thread.h:28
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 8 2024 11:58:32 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.