/usr/include/KF5/ThreadWeaver/threadweaver/thread.h is in libkf5threadweaver-dev 5.18.0-0ubuntu1.
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 | /* -*- C++ -*-
This file is part of ThreadWeaver. It declares the Thread class.
$ Author: Mirko Boehm $
$ Copyright: (C) 2004-2013 Mirko Boehm $
$ Contact: mirko@kde.org
http://www.kde.org
http://creative-destruction.me $
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.
*/
#ifndef THREADWEAVER_THREAD_H
#define THREADWEAVER_THREAD_H
#include <QtCore/QMutex>
#include <QtCore/QThread>
#include "threadweaver_export.h"
#include "jobpointer.h"
namespace ThreadWeaver
{
class Job;
class Weaver;
/** @brief Thread represents a worker thread in a Queue's inventory.
*
* Threads are created and managed by queues on demand. A Thread will try to retrieve and process
* jobs from the queue until it is told to exit. */
class THREADWEAVER_EXPORT Thread : public QThread
{
Q_OBJECT
public:
/** @brief Create a thread.
*
* @param parent the parent Weaver
*/
explicit Thread(Weaver *parent = 0);
/** The destructor. */
~Thread();
/** @brief The run method is reimplemented to execute jobs from the queue.
*
* Whenever the thread is idle, it will ask its Weaver parent for a Job to do. The Weaver will either return a Job or a null
* pointer. When a null pointer is returned, it tells the thread to exit.
*/
void run() Q_DECL_OVERRIDE;
/** @brief Returns the thread id.
*
* This id marks the respective Thread object, and must therefore not be confused with, e.g., the pthread thread ID.
* The way threads are implemented and identified is platform specific. id() is the only way to uniquely identify a thread
* within ThreadWeaver.
*/
unsigned int id() const;
/** @brief Request the abortion of the job that is processed currently.
*
* If there is no current job, this method will do nothing, but can safely be called. It forwards the request to the
* current Job.
*/
void requestAbort();
Q_SIGNALS:
//FIXME needed?
/** The thread has been started. */
void started(ThreadWeaver::Thread *);
private:
class Private;
Private *const d;
};
}
#endif
|