• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

ThreadWeaver

  • threadweaver
  • Weaver
SuspendedState.cpp
Go to the documentation of this file.
1/* -*- C++ -*-
2
3This file implements the SuspendedState class.
4
5$ Author: Mirko Boehm $
6$ Copyright: (C) 2005-2013 Mirko Boehm $
7$ Contact: mirko@kde.org
8http://www.kde.org
9http://creative-destruction.me $
10
11 This library is free software; you can redistribute it and/or
12 modify it under the terms of the GNU Library General Public
13 License as published by the Free Software Foundation; either
14 version 2 of the License, or (at your option) any later version.
15
16 This library is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 Library General Public License for more details.
20
21 You should have received a copy of the GNU Library General Public License
22 along with this library; see the file COPYING.LIB. If not, write to
23 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 Boston, MA 02110-1301, USA.
25
26$Id: SuspendedState.cpp 30 2005-08-16 16:16:04Z mirko $
27*/
28
29#include "SuspendedState.h"
30
31#include "ThreadWeaver.h"
32#include "WeaverImpl.h"
33
34using namespace ThreadWeaver;
35
36void SuspendedState::suspend()
37{
38 // this request is not handled in Suspended state
39}
40
41void SuspendedState::resume()
42{
43 weaver()->setState( WorkingHard );
44}
45
46Job* SuspendedState::applyForWork ( Thread *th, Job* previous )
47{ // suspend all threads in case they wake up:
48 weaver()->waitForAvailableJob( th );
49 return weaver()->applyForWork ( th, previous );
50}
51
52void SuspendedState::waitForAvailableJob ( Thread *th )
53{
54 weaver()->blockThreadUntilJobsAreBeingAssigned ( th );
55}
56
57StateId SuspendedState::stateId() const
58{
59 return Suspended;
60}
SuspendedState.h
ThreadWeaver.h
WeaverImpl.h
ThreadWeaver::Job
A Job is a simple abstraction of an action that is to be executed in a thread context.
Definition: Job.h:66
ThreadWeaver::StateImplementation::weaver
WeaverImpl * weaver()
Definition: StateImplementation.cpp:35
ThreadWeaver::SuspendedState::stateId
StateId stateId() const
reimpl
Definition: SuspendedState.cpp:57
ThreadWeaver::SuspendedState::waitForAvailableJob
virtual void waitForAvailableJob(Thread *th)
Wait (by suspending the calling thread) until a job becomes available.
Definition: SuspendedState.cpp:52
ThreadWeaver::SuspendedState::resume
virtual void resume()
Resume job processing.
Definition: SuspendedState.cpp:41
ThreadWeaver::SuspendedState::suspend
virtual void suspend()
Suspend job processing.
Definition: SuspendedState.cpp:36
ThreadWeaver::SuspendedState::applyForWork
virtual Job * applyForWork(Thread *th, Job *previous)
Assign a job to an idle thread.
Definition: SuspendedState.cpp:46
ThreadWeaver::Thread
The class Thread is used to represent the worker threads in the weaver's inventory.
Definition: Thread.h:47
ThreadWeaver::WeaverImpl::blockThreadUntilJobsAreBeingAssigned
void blockThreadUntilJobsAreBeingAssigned(Thread *th)
Blocks the calling thread until some actor calls assignJobs.
Definition: WeaverImpl.cpp:364
ThreadWeaver::WeaverImpl::waitForAvailableJob
void waitForAvailableJob(Thread *th)
Wait for a job to become available.
Definition: WeaverImpl.cpp:359
ThreadWeaver::WeaverImpl::setState
void setState(StateId)
Set the object state.
Definition: WeaverImpl.cpp:124
ThreadWeaver::WeaverImpl::applyForWork
virtual Job * applyForWork(Thread *thread, Job *previous)
Assign a job to the calling thread.
Definition: WeaverImpl.cpp:354
ThreadWeaver
Definition: DebuggingAids.h:51
ThreadWeaver::StateId
StateId
All weaver objects maintain a state of operation which can be queried by the application.
Definition: State.h:48
ThreadWeaver::WorkingHard
@ WorkingHard
Jobs are being processed.
Definition: State.h:53
ThreadWeaver::Suspended
@ Suspended
Job processing is suspended, and no jobs are being processed.
Definition: State.h:59
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

ThreadWeaver

Skip menu "ThreadWeaver"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal