File indexing completed on 2024-04-21 04:01:28
0001 /* -*- C++ -*- 0002 This file implements the SuspendedState 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: SuspendedState.cpp 30 2005-08-16 16:16:04Z mirko $ 0009 */ 0010 0011 #include "suspendedstate.h" 0012 0013 #include "threadweaver.h" 0014 0015 namespace ThreadWeaver 0016 { 0017 SuspendedState::SuspendedState(Weaver *weaver) 0018 : WeaverImplState(weaver) 0019 { 0020 } 0021 0022 void SuspendedState::suspend() 0023 { 0024 // this request is not handled in Suspended state 0025 } 0026 0027 void SuspendedState::resume() 0028 { 0029 weaver()->setState(WorkingHard); 0030 } 0031 0032 JobPointer SuspendedState::applyForWork(Thread *th, bool wasBusy) 0033 { 0034 // suspend all threads in case they wake up: 0035 Q_ASSERT(wasBusy == 0); 0036 weaver()->waitForAvailableJob(th); 0037 return weaver()->applyForWork(th, wasBusy); 0038 } 0039 0040 StateId SuspendedState::stateId() const 0041 { 0042 return Suspended; 0043 } 0044 0045 }