File indexing completed on 2024-04-28 15:34:51
0001 /* -*- C++ -*- 0002 This file is part of ThreadWeaver. 0003 0004 SPDX-FileCopyrightText: 2005-2013 Mirko Boehm <mirko@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.0-or-later 0007 */ 0008 0009 #include "job_p.h" 0010 #include "debuggingaids.h" 0011 #include "executor_p.h" 0012 #include "queuepolicy.h" 0013 #include "thread.h" 0014 0015 ThreadWeaver::Private::DefaultExecutor ThreadWeaver::Private::defaultExecutor; 0016 0017 ThreadWeaver::Private::Job_Private::Job_Private() 0018 : status(Job::Status_NoStatus) 0019 , executor(&defaultExecutor) 0020 { 0021 } 0022 0023 ThreadWeaver::Private::Job_Private::~Job_Private() 0024 { 0025 } 0026 0027 void ThreadWeaver::Private::Job_Private::freeQueuePolicyResources(JobPointer job) 0028 { 0029 for (int index = 0; index < queuePolicies.size(); ++index) { 0030 queuePolicies.at(index)->free(job); 0031 } 0032 } 0033 0034 void ThreadWeaver::Private::DebugExecuteWrapper::execute(const JobPointer &job, ThreadWeaver::Thread *th) 0035 { 0036 Q_ASSERT_X(job, Q_FUNC_INFO, "job may not be zero!"); 0037 TWDEBUG(3, "DefaultExecuteWrapper::execute: executing job %p in thread %i.\n", job.data(), th ? th->id() : 0); 0038 executeWrapped(job, th); 0039 TWDEBUG(3, "Job::execute: finished execution of job in thread %i.\n", th ? th->id() : 0); 0040 } 0041 0042 void ThreadWeaver::Private::DefaultExecutor::begin(const JobPointer &job, Thread *thread) 0043 { 0044 defaultBegin(job, thread); 0045 } 0046 0047 void ThreadWeaver::Private::DefaultExecutor::execute(const JobPointer &job, Thread *thread) 0048 { 0049 run(job, thread); 0050 } 0051 0052 void ThreadWeaver::Private::DefaultExecutor::end(const JobPointer &job, Thread *thread) 0053 { 0054 defaultEnd(job, thread); 0055 }