-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRunnable.h
More file actions
43 lines (30 loc) · 1.12 KB
/
Runnable.h
File metadata and controls
43 lines (30 loc) · 1.12 KB
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
42
43
//
// Created by theo on 5/22/2021.
//
#ifndef LOOPER_RUNNABLE_H
#define LOOPER_RUNNABLE_H
#include "mtlNamespce.h"
#include <functional>
class mtl::Runnable {
private:
long timeout;
std::function<void(void*)> fun;
std::function<void(void*)> destructorFun;
void* funArg;
void* destructorFunArg{};
void* runnableArg{};
bool destroy = true;
public:
Runnable(std::function<void(void *)> fun, void *funArg, bool destroy = true);
Runnable(std::function<void(void*)> fun, void *funArg, long timeout, bool destroy = true);
Runnable(std::function<void(void *)> fun, void *funArg, void *desFunArg,
std::function<void(void *)> desFun, bool destroy = true);
Runnable(std::function<void(void*)> fun, void *funArg, std::function<void(void*)>desFun, void* desFunArg, long timeout, bool destroy = true);
~Runnable();
[[nodiscard]] bool hasTimeout() const;
[[nodiscard]] long getTimeout() const;
[[nodiscard]] std::function<void(void*)> getFunction() const;
[[nodiscard]] void* getArgument() const;
[[nodiscard]] bool destroyMe() const;
};
#endif //LOOPER_RUNNABLE_H