Condy v1.6.0
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
9#include "condy/intrusive.hpp"
10
11namespace condy {
12
13class Invoker {
14public:
15 using Func = void (*)(void *) noexcept;
16
17 void operator()() noexcept { func_(this); }
18
19protected:
20 Func func_ = nullptr;
21};
22
23template <typename T, typename Invoker = Invoker>
24class InvokerAdapter : public Invoker {
25public:
26 template <typename... Args>
27 InvokerAdapter(Args &&...args) : Invoker(std::forward<Args>(args)...) {
28 this->func_ = &invoke_static_;
29 }
30
31private:
32 static void invoke_static_(void *self) noexcept {
33 static_cast<T *>(self)->invoke();
34 }
35};
36
37class WorkInvoker : public Invoker {
38public:
39 SingleLinkEntry work_queue_entry_;
40};
41
42} // namespace condy
Intrusive single-linked and double-linked list implementations.
The main namespace for the Condy library.
Definition condy.hpp:30