File indexing completed on 2024-05-12 07:57:49
0001 /* -*- C++ -*- 0002 This file declares the WeaverInterface class. 0003 0004 SPDX-FileCopyrightText: 2005-2013 Mirko Boehm <mirko@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.0-or-later 0007 */ 0008 0009 #ifndef WEAVER_INTERFACE_H 0010 #define WEAVER_INTERFACE_H 0011 0012 #include "jobpointer.h" 0013 0014 namespace ThreadWeaver 0015 { 0016 class Job; 0017 class Thread; 0018 0019 class THREADWEAVER_EXPORT WeaverInterface 0020 { 0021 public: 0022 virtual ~WeaverInterface() 0023 { 0024 } 0025 0026 /** @brief Assign a job to an idle thread. 0027 * @param th the thread to give a new Job to 0028 * @param wasBusy true if a job was previously assigned to the calling thread 0029 */ 0030 virtual JobPointer applyForWork(Thread *th, bool wasBusy) = 0; 0031 0032 /** @brief Wait (by suspending the calling thread) until a job becomes available. */ 0033 virtual void waitForAvailableJob(Thread *th) = 0; 0034 }; 0035 0036 } 0037 0038 #endif // WEAVER_INTERFACE_H