Condy v1.1.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 *);
16 Invoker(Func func) : func_(func) {}
17
18 void operator()() { func_(this); }
19
20protected:
21 Func func_;
22};
23
24template <typename T, typename Invoker = Invoker>
25class InvokerAdapter : public Invoker {
26public:
27 InvokerAdapter() : Invoker(&InvokerAdapter::invoke_) {}
28
29private:
30 static void invoke_(void *self) { static_cast<T *>(self)->invoke(); }
31};
32
33class WorkInvoker : public Invoker {
34public:
35 using Invoker::Invoker;
36 SingleLinkEntry work_queue_entry_;
37};
38
39} // namespace condy
Intrusive single-linked and double-linked list implementations.
The main namespace for the Condy library.
Definition condy.hpp:28