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

ThreadWeaver

  • threadweaver
  • Weaver
InConstructionState.cpp
Go to the documentation of this file.
1 /* -*- C++ -*-
2 
3  This file implements the InConstructionState class.
4 
5  $ Author: Mirko Boehm $
6  $ Copyright: (C) 2005-2013 Mirko Boehm $
7  $ Contact: mirko@kde.org
8  http://www.kde.org
9  http://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: InConstructionState.cpp 30 2005-08-16 16:16:04Z mirko $
27 */
28 
29 #include "InConstructionState.h"
30 
31 #include "WeaverImpl.h"
32 #include "ThreadWeaver.h"
33 
34 namespace ThreadWeaver {
35 
36  void InConstructionState::suspend()
37  {
38  // this request is not handled in InConstruction state
39  }
40 
41  void InConstructionState::resume()
42  {
43  // this request is not handled in InConstruction state
44  }
45 
46  Job* InConstructionState::applyForWork ( Thread *th, Job *previous)
47  {
48  // As long as we are in the construction state, no jobs will be given
49  // to the worker threads. The threads will be suspended. They will
50  // return from the blocked state when jobs are queued. By then, we
51  // should not be in InConstruction state anymore, and we hand the job
52  // application over to the then active state.
53  while ( weaver()->state().stateId() == InConstruction )
54  {
55  weaver()->waitForAvailableJob ( th);
56  }
57  return weaver()->applyForWork ( th, previous );
58  }
59 
60  void InConstructionState::waitForAvailableJob ( Thread * th)
61  {
62  weaver()->blockThreadUntilJobsAreBeingAssigned ( th );
63  }
64 
65  StateId InConstructionState::stateId() const
66  {
67  return InConstruction;
68  }
69 
70 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Sep 23 2014 09:57:13 by doxygen 1.8.3.1 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.11.5 API Reference

Skip menu "kdelibs-4.11.5 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