File: executewrapper_p.h

package info (click to toggle)
threadweaver 5.116.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,312 kB
  • sloc: cpp: 7,345; python: 33; sh: 13; makefile: 5
file content (41 lines) | stat: -rw-r--r-- 976 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* -*- C++ -*-
    Class to manipulate job execution in ThreadWeaver.

    SPDX-FileCopyrightText: 2005-2013 Mirko Boehm <mirko@kde.org>

    SPDX-License-Identifier: LGPL-2.0-or-later
*/

#ifndef EXECUTEWRAPPER_H
#define EXECUTEWRAPPER_H

#include <QAtomicPointer>

#include "executor_p.h"
#include "job.h"

namespace ThreadWeaver
{
class Job;
class Thread;

// FIXME Pimpl, make part of the API, document
// Find a way to avoid new/delete operation, this is rather performance sensitive area
class ExecuteWrapper : public Executor
{
public:
    ExecuteWrapper();
    Executor *wrap(Executor *previous);
    Executor *unwrap(const JobPointer &job);
    void begin(const JobPointer &job, Thread *) override;
    void execute(const JobPointer &job, Thread *thread) override;
    void executeWrapped(const JobPointer &job, Thread *thread);
    void end(const JobPointer &job, Thread *) override;

private:
    QAtomicPointer<Executor> wrapped;
};

}

#endif // EXECUTEWRAPPER_H