digiKam
threadmanager.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2010-04-13
7  * Description : Thread object scheduling
8  *
9  * Copyright (C) 2010-2012 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option)
15  * any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_THREAD_MANAGER_H
25 #define DIGIKAM_THREAD_MANAGER_H
26 
27 // Qt includes
28 
29 #include <QObject>
30 #include <QRunnable>
31 
32 // Local includes
33 
34 #include "digikam_export.h"
35 
36 namespace Digikam
37 {
38 
39 class DynamicThread;
40 class WorkerObject;
41 
42 class DIGIKAM_EXPORT ThreadManager : public QObject
43 {
44  Q_OBJECT
45 
46 public:
47 
48  static ThreadManager* instance();
49 
50  void initialize(WorkerObject* const object);
51  void initialize(DynamicThread* const dynamicThread);
52 
53 public Q_SLOTS:
54 
55  void schedule(WorkerObject* object);
56  void schedule(QRunnable* runnable);
57 
58 protected Q_SLOTS:
59 
60  void slotDestroyed(QObject* object);
61 
62 protected:
63 
64  explicit ThreadManager();
65  ~ThreadManager() override;
66 
67 private:
68 
69  // Disable
70  explicit ThreadManager(QObject*) = delete;
71  ThreadManager(const ThreadManager&) = delete;
72  ThreadManager& operator=(const ThreadManager&) = delete;
73 
74 private:
75 
76  friend class ThreadManagerCreator;
77 
78  class Private;
79  Private* const d;
80 };
81 
82 } // namespace Digikam
83 
84 #endif // DIGIKAM_THREAD_MANAGER_H
Definition: dynamicthread.h:43
Definition: threadmanager.h:43
Definition: workerobject.h:45
Definition: datefolderview.cpp:43