ThreadWeaver

managedjobpointer.h
1 /* -*- C++ -*-
2  Shared pointer based jobs that are managed by the caller in ThreadWeaver.
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 MANAGEDJOBPOINTER_H
10 #define MANAGEDJOBPOINTER_H
11 
12 #include <QSharedPointer>
13 
14 #include "jobinterface.h"
15 
16 namespace ThreadWeaver
17 {
18 inline void doNotDeleteJob(JobInterface *)
19 {
20 }
21 
22 template<typename T>
23 class ManagedJobPointer : public QSharedPointer<T>
24 {
25 public:
26  ManagedJobPointer(T *job)
27  : QSharedPointer<T>(job, doNotDeleteJob)
28  {
29  }
30 };
31 
32 }
33 
34 #endif // MANAGEDJOBPOINTER_H
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Thu Feb 15 2024 04:07:51 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.