File indexing completed on 2024-04-21 04:01:28
0001 /* -*- C++ -*- 0002 This file implements the SuspendingState class. 0003 0004 SPDX-FileCopyrightText: 2005-2013 Mirko Boehm <mirko@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.0-or-later 0007 0008 $Id: SuspendingState.cpp 30 2005-08-16 16:16:04Z mirko $ 0009 */ 0010 0011 #include "suspendingstate.h" 0012 0013 #include "state.h" 0014 #include "threadweaver.h" 0015 0016 namespace ThreadWeaver 0017 { 0018 SuspendingState::SuspendingState(Weaver *weaver) 0019 : WeaverImplState(weaver) 0020 { 0021 } 0022 0023 void SuspendingState::suspend() 0024 { 0025 // this request is not handled in Suspending state (we are already suspending...) 0026 } 0027 0028 void SuspendingState::resume() 0029 { 0030 weaver()->setState(WorkingHard); 0031 } 0032 0033 void SuspendingState::activated() 0034 { 0035 weaver()->reschedule(); 0036 } 0037 0038 JobPointer SuspendingState::applyForWork(Thread *th, bool wasBusy) 0039 { 0040 weaver()->takeFirstAvailableJobOrSuspendOrWait(th, wasBusy, true, true); 0041 weaver()->waitForAvailableJob(th); 0042 return weaver()->applyForWork(th, false); 0043 } 0044 0045 StateId SuspendingState::stateId() const 0046 { 0047 return Suspending; 0048 } 0049 0050 }