/usr/include/threadweaver/ThreadWeaver.h is in kdelibs5-dev 4:4.8.4-4+deb7u1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | /* -*- C++ -*-
This file implements the public interfaces of the Weaver and the Job class.
It should be the only include file necessary to use the ThreadWeaver
library.
$ Author: Mirko Boehm $
$ Copyright: (C) 2005, Mirko Boehm $
$ Contact: mirko@kde.org
http://www.kde.org
http://www.hackerbuero.org $
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
$Id: ThreadWeaver.h 32 2005-08-17 08:38:01Z mirko $
*/
#ifndef THREADWEAVER_H
#define THREADWEAVER_H
#include <QtCore/QObject>
#include "WeaverInterface.h"
namespace ThreadWeaver {
class Job;
class State;
class WeaverObserver;
/** The Weaver class provides the public implementation of the WeaverInterface.
Weaver provides a static instance that can be used to perform jobs in
threads without managing a weaver object. The static instance will
only be created when it is first accessed. Also, Weaver objects will
create the threads only when the first jobs are queued. Therefore, the
creation of a Weaver object is a rather cheap operation.
The WeaverImpl class provides two parts of API - one for the threads
that are handled by it, and one for the ThreadWeaver users
(application developers). To separate those two different API parts,
Weaver only provides the interface supposed to be used by developers
of multithreaded applications.
Weaver creates and destroys WeaverImpl objects. It hides the
implementation details of the WeaverImpl class. It is strongly
discouraged to use the WeaverImpl class in programs, as its API will
be changed without notice.
Also, Weaver provides a factory method for this purpose that can be overloaded to create
derived WeaverImpl objects.
*/
// Note: All member documentation is in the WeaverInterface class.
class THREADWEAVER_EXPORT Weaver : public WeaverInterface
{
Q_OBJECT
public:
/** Construct a Weaver object. */
Weaver ( QObject* parent=0 );
/** Destruct a Weaver object. */
virtual ~Weaver ();
const State& state() const;
void setMaximumNumberOfThreads( int cap );
int maximumNumberOfThreads() const;
int currentNumberOfThreads () const;
void registerObserver ( WeaverObserver* );
/** Return the global Weaver instance.
In some cases, a global Weaver object per application is
sufficient for the applications purpose. If this is the case,
query instance() to a pointer to a global instance.
If instance is never called, a global Weaver object will not be
created.
*/
// FIXME (0.7) this should be a WeaverInterface pointer
static ThreadWeaver::Weaver* instance();
virtual void enqueue (Job*);
virtual bool dequeue (Job*);
virtual void dequeue ();
virtual void finish();
virtual void suspend( );
virtual void resume();
bool isEmpty () const;
bool isIdle () const;
int queueLength () const;
void requestAbort();
protected:
/** The factory method to create the actual Weaver implementation.
Overload this method to use a different or adapted implementation.
*/
virtual WeaverInterface* makeWeaverImpl ();
private:
class Private;
Private* const d;
};
}
#endif // THREADWEAVER_H
|