ThreadWeaver

suspendingstate.cpp
1 /* -*- C++ -*-
2  This file implements the SuspendingState class.
3 
4  SPDX-FileCopyrightText: 2005-2013 Mirko Boehm <[email protected]>
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 
16 namespace ThreadWeaver
17 {
18 SuspendingState::SuspendingState(Weaver *weaver)
19  : WeaverImplState(weaver)
20 {
21 }
22 
24 {
25  // this request is not handled in Suspending state (we are already suspending...)
26 }
27 
29 {
30  weaver()->setState(WorkingHard);
31 }
32 
34 {
35  weaver()->reschedule();
36 }
37 
39 {
40  weaver()->takeFirstAvailableJobOrSuspendOrWait(th, wasBusy, true, true);
42  return weaver()->applyForWork(th, false);
43 }
44 
45 StateId SuspendingState::stateId() const
46 {
47  return Suspending;
48 }
49 
50 }
void reschedule() override
Reschedule the jobs in the queue.
Definition: weaver.cpp:380
JobPointer takeFirstAvailableJobOrSuspendOrWait(Thread *th, bool threadWasBusy, bool suspendIfAllThreadsInactive, bool justReturning)
Take the first available job out of the queue and return it.
Definition: weaver.cpp:505
StateId stateId() const override
reimpl
JobPointer applyForWork(Thread *thread, bool wasBusy) override
Assign a job to the calling thread.
Definition: weaver.cpp:573
Weaver * weaver() override
Provide correct return type for WeaverImpl states.
void waitForAvailableJob(Thread *th) override
Wait for a job to become available.
Definition: weaver.cpp:579
void suspend() override
Suspend job processing.
void activated() override
Overload.
void setState(StateId)
Set the Weaver state.
Definition: weaver.cpp:126
Thread represents a worker thread in a Queue's inventory.
Definition: thread.h:27
JobPointer applyForWork(Thread *th, bool wasBusy) override
Assign a job to an idle thread.
void resume() override
Resume job processing.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Sep 21 2023 04:10:21 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.