1 | /* -*- C++ -*- |
2 | This file declares the WeaverInterface class. |
3 | |
4 | SPDX-FileCopyrightText: 2005-2013 Mirko Boehm <mirko@kde.org> |
5 | |
6 | SPDX-License-Identifier: LGPL-2.0-or-later |
7 | */ |
8 | |
9 | #ifndef WEAVER_INTERFACE_H |
10 | #define WEAVER_INTERFACE_H |
11 | |
12 | #include "jobpointer.h" |
13 | |
14 | namespace ThreadWeaver |
15 | { |
16 | class Job; |
17 | class Thread; |
18 | |
19 | class THREADWEAVER_EXPORT WeaverInterface |
20 | { |
21 | public: |
22 | virtual ~WeaverInterface() |
23 | { |
24 | } |
25 | |
26 | /** @brief Assign a job to an idle thread. |
27 | * @param th the thread to give a new Job to |
28 | * @param wasBusy true if a job was previously assigned to the calling thread |
29 | */ |
30 | virtual JobPointer applyForWork(Thread *th, bool wasBusy) = 0; |
31 | |
32 | /** @brief Wait (by suspending the calling thread) until a job becomes available. */ |
33 | virtual void waitForAvailableJob(Thread *th) = 0; |
34 | }; |
35 | |
36 | } |
37 | |
38 | #endif // WEAVER_INTERFACE_H |
39 | |