1/* -*- C++ -*-
2 Wrap functors in jobs 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 LAMBDA_H
10#define LAMBDA_H
11
12#include "job.h"
13#include "threadweaver_export.h"
14
15namespace ThreadWeaver
16{
17template<typename T>
18/*
19 * Lambda is a template that takes any type on which operator() is available, and executes it in run()
20 */
21class Lambda : public Job
22{
23public:
24 /*!
25 */
26 explicit Lambda(T t_)
27 : t(t_)
28 {
29 }
30
31protected:
32 void run(JobPointer, Thread *) override
33 {
34 t();
35 }
36
37private:
38 T t;
39};
40
41}
42
43#endif // LAMBDA_H
44

source code of threadweaver/src/lambda.h