di 0.1.0
Loading...
Searching...
No Matches
in_place_stop_callback_base.h
Go to the documentation of this file.
1#pragma once
2
4#include "di/sync/atomic.h"
6
7namespace di::sync::detail {
8class InPlaceStopCallbackBase : public container::IntrusiveListNode<> {
9private:
10 friend class ::di::sync::InPlaceStopSource;
11
12 using ErasedCallback = void (*)(void*);
13
14protected:
15 explicit InPlaceStopCallbackBase(InPlaceStopSource const* parent, ErasedCallback execute)
16 : m_parent(parent), m_execute(execute) {}
17
18 InPlaceStopSource const* m_parent { nullptr };
19 ErasedCallback m_execute { nullptr };
20 Atomic<bool> m_already_executed { false };
21 Atomic<bool*> m_did_destruct_in_same_thread { nullptr };
22
23private:
24 void execute() { m_execute(this); }
25};
26}