1 | /* -*- C++ -*- |
---|---|
2 | This file is part of ThreadWeaver. |
3 | |
4 | SPDX-FileCopyrightText: 2004-2013 Mirko Boehm <mirko@kde.org> |
5 | |
6 | SPDX-License-Identifier: LGPL-2.0-or-later |
7 | */ |
8 | |
9 | #ifndef SEQUENCE_P_H |
10 | #define SEQUENCE_P_H |
11 | |
12 | #include <QAtomicInt> |
13 | |
14 | #include "collection_p.h" |
15 | #include "queuepolicy.h" |
16 | #include "sequence.h" |
17 | |
18 | namespace ThreadWeaver |
19 | { |
20 | namespace Private |
21 | { |
22 | class BlockerPolicy : public QueuePolicy |
23 | { |
24 | public: |
25 | bool canRun(JobPointer) override; |
26 | void free(JobPointer) override; |
27 | void release(JobPointer) override; |
28 | void destructed(JobInterface *job) override; |
29 | }; |
30 | |
31 | class Sequence_Private : public Collection_Private |
32 | { |
33 | public: |
34 | Sequence_Private(); |
35 | BlockerPolicy *blocker(); |
36 | void prepareToEnqueueElements() override; |
37 | void processCompletedElement(Collection *collection, JobPointer job, Thread *thread) override; |
38 | void elementDequeued(const JobPointer &job) override; |
39 | BlockerPolicy blocker_; |
40 | QAtomicInt completed_; |
41 | }; |
42 | |
43 | } |
44 | |
45 | } |
46 | |
47 | #endif // SEQUENCE_P_H |
48 |