File indexing completed on 2024-04-28 04:01:24

0001 /* -*- C++ -*-
0002     This file declares 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.h 32 2005-08-17 08:38:01Z mirko $
0009 */
0010 
0011 #ifndef SuspendingState_H
0012 #define SuspendingState_H
0013 
0014 #include "weaver.h"
0015 #include "weaverimplstate.h"
0016 
0017 namespace ThreadWeaver
0018 {
0019 /** SuspendingState is the state after suspend() has been called, but
0020  *  before all threads finished executing the current job and blocked.
0021  */
0022 class SuspendingState : public WeaverImplState
0023 {
0024 public:
0025     explicit SuspendingState(Weaver *weaver);
0026     /** Suspend job processing. */
0027     void suspend() override;
0028     /** Resume job processing. */
0029     void resume() override;
0030     /** Assign a job to an idle thread. */
0031     JobPointer applyForWork(Thread *th, bool wasBusy) override;
0032     /** Overload. */
0033     void activated() override;
0034     /** reimpl */
0035     StateId stateId() const override;
0036 };
0037 
0038 }
0039 
0040 #endif // SuspendingState_H