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{
17/** @brief Lambda is a template that takes any type on which operator() is available, and executes it in run(). */
18template<typename T>
19class Lambda : public Job
20{
21public:
22 explicit Lambda(T t_)
23 : t(t_)
24 {
25 }
26
27protected:
28 void run(JobPointer, Thread *) override
29 {
30 t();
31 }
32
33private:
34 T t;
35};
36
37}
38
39#endif // LAMBDA_H
40

source code of threadweaver/src/lambda.h