Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
ThreadClosure.h
Go to the documentation of this file.
1#pragma once
2#include <misc/gen/Thread.h>
3
4namespace sf
5{
33 : public Thread
34 , public TClosure<int, Thread&>
35{
36 public:
40 ThreadClosure(const std::string& name = "")
41 : Thread(name)
42 , TClosure<int, Thread&>()
43 {}
44
50 explicit ThreadClosure(const func_type& func, const std::string& name = "")
51 : Thread(name)
52 , TClosure<int, Thread&>(func)
53 {}
54
55 protected:
59 int run() override
60 {
61 return isAssigned() ? call(*this) : 0;
62 }
63};
64
65}// namespace sf
std::function< int(Args...)> func_type
Definition TClosure.h:19
int call(Args... args) const
ThreadClosure(const func_type &func, const std::string &name="")
Thread run function assigment constructor.
Definition ThreadClosure.h:50
int run() override
Definition ThreadClosure.h:59
ThreadClosure(const std::string &name="")
Default constructor.
Definition ThreadClosure.h:40
Thread(const Thread &)=delete
Copying constructor disabled and not implemented.
Definition Application.h:10