Condy v1.8
C++ Asynchronous System Call Layer for Linux
Loading...
Searching...
No Matches
invoker.hpp
Go to the documentation of this file.
1
6
7#pragma once
8
10
11namespace condy {
12namespace detail {
13
14class Invoker {
15public:
16 using Func = void (*)(void *) noexcept;
17
18 void operator()() noexcept { func_(this); }
19
20protected:
21 Func func_ = nullptr;
22};
23
24template <typename T, typename Invoker = Invoker>
25class InvokerAdapter : public Invoker {
26public:
27 template <typename... Args>
28 InvokerAdapter(Args &&...args) : Invoker(std::forward<Args>(args)...) {
29 this->func_ = &invoke_static_;
30 }
31
32private:
33 static void invoke_static_(void *self) noexcept {
34 static_cast<T *>(self)->invoke();
35 }
36};
37
38class WorkInvoker : public Invoker {
39public:
40 SingleLinkEntry work_queue_entry_;
41};
42
43} // namespace detail
44} // namespace condy
Intrusive single-linked and double-linked list implementations.
The main namespace for the Condy library.
Definition condy.hpp:37