Commit 73ffae31 authored by Xavier Thompson's avatar Xavier Thompson

Reroganise source tree into unified include/typon

parent 68ca2bb2
#ifndef TYPON_CORE_CONTINUATION_HPP_INCLUDED #ifndef TYPON_CONTINUATION_HPP_INCLUDED
#define TYPON_CORE_CONTINUATION_HPP_INCLUDED #define TYPON_CONTINUATION_HPP_INCLUDED
#include <coroutine> #include <coroutine>
#include <cstdint> #include <cstdint>
......
#ifndef TYPON_FUNDAMENTAL_SCOPE_HPP_INCLUDED #ifndef TYPON_SCOPE_HPP_INCLUDED
#define TYPON_FUNDAMENTAL_SCOPE_HPP_INCLUDED #define TYPON_SCOPE_HPP_INCLUDED
#include <concepts> #include <concepts>
namespace typon::fdt namespace typon
{ {
template <std::invocable<> F> template <std::invocable<> F>
struct defer struct Defer
{ {
F _f; F _f;
~defer() ~Defer()
{ {
_f(); _f();
} }
}; };
template <std::invocable<> F> template <std::invocable<> F>
defer(F) -> defer<F>; Defer(F) -> Defer<F>;
} }
#endif // TYPON_FUNDAMENTAL_SCOPE_HPP_INCLUDED #endif // TYPON_SCOPE_HPP_INCLUDED
#ifndef TYPON_EVENTCOUNT_HPP_INCLUDED #ifndef TYPON_EVENT_COUNT_HPP_INCLUDED
#define TYPON_EVENTCOUNT_HPP_INCLUDED #define TYPON_EVENT_COUNT_HPP_INCLUDED
#include <atomic> #include <atomic>
#include <cstdint> #include <cstdint>
namespace typon::fdt::lock_free namespace typon
{ {
template <unsigned int N = 10> template <unsigned int N = 10>
struct event_count struct EventCount
{ {
using u64 = std::uint_fast64_t; using u64 = std::uint_fast64_t;
...@@ -63,4 +63,4 @@ namespace typon::fdt::lock_free ...@@ -63,4 +63,4 @@ namespace typon::fdt::lock_free
} }
#endif // TYPON_EVENTCOUNT_HPP_INCLUDED #endif // TYPON_EVENT_COUNT_HPP_INCLUDED
#ifndef TYPON_CORE_FORK_HPP_INCLUDED #ifndef TYPON_FORK_HPP_INCLUDED
#define TYPON_CORE_FORK_HPP_INCLUDED #define TYPON_FORK_HPP_INCLUDED
#include <coroutine> #include <coroutine>
#include <cstdint> #include <cstdint>
#include <typon/core/forked.hpp> #include <typon/forked.hpp>
#include <typon/core/parent.hpp> #include <typon/parent.hpp>
#include <typon/core/result.hpp> #include <typon/result.hpp>
#include <typon/core/scheduler.hpp> #include <typon/scheduler.hpp>
namespace typon namespace typon
......
#ifndef TYPON_CORE_FORKED_HPP_INCLUDED #ifndef TYPON_FORKED_HPP_INCLUDED
#define TYPON_CORE_FORKED_HPP_INCLUDED #define TYPON_FORKED_HPP_INCLUDED
#include <coroutine> #include <coroutine>
#include <memory> #include <memory>
#include <type_traits> #include <type_traits>
#include <utility> #include <utility>
#include <typon/fundamental/scope.hpp> #include <typon/defer.hpp>
#include <typon/result.hpp>
#include <typon/core/result.hpp>
namespace typon namespace typon
...@@ -30,7 +29,7 @@ namespace typon ...@@ -30,7 +29,7 @@ namespace typon
{ {
if (ready) if (ready)
{ {
fdt::defer defer { [&coroutine]() { coroutine.destroy(); } }; Defer defer { [&coroutine]() { coroutine.destroy(); } };
std::construct_at(std::addressof(_value), coroutine.promise().get()); std::construct_at(std::addressof(_value), coroutine.promise().get());
} }
else else
...@@ -152,7 +151,7 @@ namespace typon ...@@ -152,7 +151,7 @@ namespace typon
{ {
if (ready) if (ready)
{ {
fdt::defer defer { [&coroutine]() { coroutine.destroy(); } }; Defer defer { [&coroutine]() { coroutine.destroy(); } };
std::construct_at(std::addressof(_value), coroutine.promise().get()); std::construct_at(std::addressof(_value), coroutine.promise().get());
} }
else else
...@@ -196,7 +195,7 @@ namespace typon ...@@ -196,7 +195,7 @@ namespace typon
{ {
if (ready) if (ready)
{ {
fdt::defer defer { [&coroutine]() { coroutine.destroy(); } }; Defer defer { [&coroutine]() { coroutine.destroy(); } };
_value = std::addressof(coroutine.promise().get()); _value = std::addressof(coroutine.promise().get());
} }
else else
...@@ -228,7 +227,7 @@ namespace typon ...@@ -228,7 +227,7 @@ namespace typon
{ {
if (ready) if (ready)
{ {
fdt::defer defer { [&coroutine]() { coroutine.destroy(); } }; Defer defer { [&coroutine]() { coroutine.destroy(); } };
coroutine.promise().get(); coroutine.promise().get();
} }
else else
......
#ifndef TYPON_META_HPP_INCLUDED
#define TYPON_META_HPP_INCLUDED
namespace typon::fdt::meta
{
template <template <typename ...> typename T>
struct lazy
{
template <typename... Args>
using type = T<Args...>;
};
template <typename... T>
static constexpr bool always_false_v { false };
}
#endif // TYPON_META_HPP_INCLUDED
#ifndef TYPON_CORE_FUTURE_HPP_INCLUDED #ifndef TYPON_FUTURE_HPP_INCLUDED
#define TYPON_CORE_FUTURE_HPP_INCLUDED #define TYPON_FUTURE_HPP_INCLUDED
#include <atomic> #include <atomic>
#include <coroutine> #include <coroutine>
#include <cstdint> #include <cstdint>
#include <typon/core/continuation.hpp> #include <typon/continuation.hpp>
#include <typon/core/result.hpp> #include <typon/result.hpp>
#include <typon/core/scheduler.hpp> #include <typon/scheduler.hpp>
#include <typon/core/stack.hpp> #include <typon/stack.hpp>
namespace typon namespace typon
...@@ -183,4 +183,4 @@ namespace typon ...@@ -183,4 +183,4 @@ namespace typon
} }
#endif // TYPON_CORE_FUTURE_HPP_INCLUDED #endif // TYPON_FUTURE_HPP_INCLUDED
#ifndef TYPON_FUNDAMENTAL_GARBAGE_COLLECTOR_HPP_INCLUDED #ifndef TYPON_GARBAGE_COLLECTOR_HPP_INCLUDED
#define TYPON_FUNDAMENTAL_GARBAGE_COLLECTOR_HPP_INCLUDED #define TYPON_GARBAGE_COLLECTOR_HPP_INCLUDED
#include <atomic> #include <atomic>
#include <bit> #include <bit>
...@@ -7,10 +7,10 @@ ...@@ -7,10 +7,10 @@
#include <type_traits> #include <type_traits>
namespace typon::fdt::lock_free namespace typon
{ {
struct garbage_collector struct GarbageCollector
{ {
using u64 = std::uint_fast64_t; using u64 = std::uint_fast64_t;
using uint = unsigned int; using uint = unsigned int;
...@@ -50,7 +50,7 @@ namespace typon::fdt::lock_free ...@@ -50,7 +50,7 @@ namespace typon::fdt::lock_free
std::atomic<node *> _head; std::atomic<node *> _head;
std::atomic<node *> _tail; std::atomic<node *> _tail;
garbage_collector(uint concurrency) noexcept GarbageCollector(uint concurrency) noexcept
: _concurrency(concurrency) : _concurrency(concurrency)
, _bits(std::bit_width(concurrency)) , _bits(std::bit_width(concurrency))
, _stamps(new std::atomic<u64>[concurrency]) , _stamps(new std::atomic<u64>[concurrency])
...@@ -66,19 +66,19 @@ namespace typon::fdt::lock_free ...@@ -66,19 +66,19 @@ namespace typon::fdt::lock_free
auto epoch(uint id) noexcept auto epoch(uint id) noexcept
{ {
struct epoch struct Epoch
{ {
garbage_collector & _gc; GarbageCollector & _gc;
uint _id; uint _id;
~epoch() ~Epoch()
{ {
_gc.leave(_id); _gc.leave(_id);
} }
}; };
enter(id); enter(id);
return epoch { *this, id }; return Epoch { *this, id };
} }
void enter(uint id) noexcept void enter(uint id) noexcept
...@@ -149,7 +149,7 @@ namespace typon::fdt::lock_free ...@@ -149,7 +149,7 @@ namespace typon::fdt::lock_free
} }
} }
~garbage_collector() ~GarbageCollector()
{ {
delete[] _stamps; delete[] _stamps;
auto tail = _tail.load(); auto tail = _tail.load();
...@@ -164,4 +164,4 @@ namespace typon::fdt::lock_free ...@@ -164,4 +164,4 @@ namespace typon::fdt::lock_free
} }
#endif // TYPON_FUNDAMENTAL_GARBAGE_COLLECTOR_HPP_INCLUDED #endif // TYPON_GARBAGE_COLLECTOR_HPP_INCLUDED
#ifndef TYPON_CORE_JOIN_HPP_INCLUDED #ifndef TYPON_JOIN_HPP_INCLUDED
#define TYPON_CORE_JOIN_HPP_INCLUDED #define TYPON_JOIN_HPP_INCLUDED
#include <coroutine> #include <coroutine>
#include <utility> #include <utility>
#include <typon/core/parent.hpp> #include <typon/parent.hpp>
#include <typon/core/result.hpp> #include <typon/result.hpp>
namespace typon namespace typon
......
#ifndef TYPON_CORE_PARENT_HPP_INCLUDED #ifndef TYPON_PARENT_HPP_INCLUDED
#define TYPON_CORE_PARENT_HPP_INCLUDED #define TYPON_PARENT_HPP_INCLUDED
#include <atomic> #include <atomic>
#include <concepts> #include <concepts>
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include <limits> #include <limits>
#include <vector> #include <vector>
#include <typon/core/continuation.hpp> #include <typon/continuation.hpp>
namespace typon namespace typon
...@@ -104,4 +104,4 @@ namespace typon ...@@ -104,4 +104,4 @@ namespace typon
} }
#endif // TYPON_CORE_PARENT_HPP_INCLUDED #endif // TYPON_PARENT_HPP_INCLUDED
#ifndef TYPON_CORE_POOL_HPP_INCLUDED #ifndef TYPON_POOL_HPP_INCLUDED
#define TYPON_CORE_POOL_HPP_INCLUDED #define TYPON_POOL_HPP_INCLUDED
#include <mutex> #include <mutex>
#include <vector> #include <vector>
#include <typon/core/stack.hpp> #include <typon/stack.hpp>
namespace typon namespace typon
...@@ -66,4 +66,4 @@ namespace typon ...@@ -66,4 +66,4 @@ namespace typon
} }
#endif // TYPON_CORE_POOL_HPP_INCLUDED #endif // TYPON_POOL_HPP_INCLUDED
#ifndef TYPON_CORE_PROMISE_HPP_INCLUDED #ifndef TYPON_PROMISE_HPP_INCLUDED
#define TYPON_CORE_PROMISE_HPP_INCLUDED #define TYPON_PROMISE_HPP_INCLUDED
#include <atomic> #include <atomic>
#include <cstdint> #include <cstdint>
#include <memory> #include <memory>
#include <type_traits> #include <type_traits>
#include <typon/fundamental/scope.hpp> #include <typon/defer.hpp>
#include <typon/stack.hpp>
#include <typon/core/stack.hpp> #include <typon/scheduler.hpp>
#include <typon/core/scheduler.hpp>
namespace typon namespace typon
...@@ -66,7 +65,7 @@ namespace typon ...@@ -66,7 +65,7 @@ namespace typon
T await_resume() noexcept T await_resume() noexcept
{ {
fdt::defer defer( [this]() { std::destroy_at(std::addressof(_value)); }); Defer defer( [this]() { std::destroy_at(std::addressof(_value)); });
_consumed = true; _consumed = true;
return std::move(_value); return std::move(_value);
} }
...@@ -197,4 +196,4 @@ namespace typon ...@@ -197,4 +196,4 @@ namespace typon
} }
#endif // TYPON_CORE_PROMISE_HPP_INCLUDED #endif // TYPON_PROMISE_HPP_INCLUDED
#ifndef TYPON_FUNDAMENTAL_RANDOM_HPP_INCLUDED #ifndef TYPON_RANDOM_HPP_INCLUDED
#define TYPON_FUNDAMENTAL_RANDOM_HPP_INCLUDED #define TYPON_RANDOM_HPP_INCLUDED
#include <random> #include <random>
namespace typon::fdt::random namespace typon::random
{ {
static thread_local std::mt19937 random { std::random_device{}() }; static thread_local std::mt19937 random { std::random_device{}() };
...@@ -14,4 +14,4 @@ namespace typon::fdt::random ...@@ -14,4 +14,4 @@ namespace typon::fdt::random
} }
#endif // TYPON_FUNDAMENTAL_RANDOM_HPP_INCLUDED #endif // TYPON_RANDOM_HPP_INCLUDED
#ifndef TYPON_CORE_RESULT_HPP_INCLUDED #ifndef TYPON_RESULT_HPP_INCLUDED
#define TYPON_CORE_RESULT_HPP_INCLUDED #define TYPON_RESULT_HPP_INCLUDED
#include <exception> #include <exception>
......
#ifndef TYPON_FUNDAMENTAL_BINARY_RING_HPP_INCLUDED #ifndef TYPON_RING_HPP_INCLUDED
#define TYPON_FUNDAMENTAL_BINARY_RING_HPP_INCLUDED #define TYPON_RING_HPP_INCLUDED
#include <atomic> #include <atomic>
#include <cstdint> #include <cstdint>
#include <type_traits> #include <type_traits>
namespace typon::fdt namespace typon
{ {
template <typename I> template <typename I>
requires std::is_unsigned_v<I> requires std::is_unsigned_v<I>
struct binary_ring struct Ring
{ {
const I _mask; const I _mask;
binary_ring(std::uint_least8_t bits) noexcept Ring(std::uint_least8_t bits) noexcept
: _mask((I(1) << bits) - 1) : _mask((I(1) << bits) - 1)
{} {}
...@@ -24,7 +24,7 @@ namespace typon::fdt ...@@ -24,7 +24,7 @@ namespace typon::fdt
return _mask + 1; return _mask + 1;
} }
friend I operator % (I x, binary_ring ring) noexcept friend I operator % (I x, Ring ring) noexcept
{ {
return x & ring._mask; return x & ring._mask;
} }
...@@ -33,4 +33,4 @@ namespace typon::fdt ...@@ -33,4 +33,4 @@ namespace typon::fdt
} }
#endif // TYPON_FUNDAMENTAL_BINARY_RING_HPP_INCLUDED #endif // TYPON_RING_HPP_INCLUDED
#ifndef TYPON_FUNDAMENTAL_RINGBUFFER_HPP_INCLUDED #ifndef TYPON_RING_BUFFER_HPP_INCLUDED
#define TYPON_FUNDAMENTAL_RINGBUFFER_HPP_INCLUDED #define TYPON_RING_BUFFER_HPP_INCLUDED
#include <atomic> #include <atomic>
#include <bit> #include <bit>
#include <cstdint> #include <cstdint>
#include <type_traits> #include <type_traits>
#include <typon/fundamental/binary_ring.hpp> #include <typon/ring.hpp>
namespace typon::fdt::lock_free namespace typon
{ {
template <typename T> template <typename T>
requires std::is_trivially_copyable_v<T> requires std::is_trivially_copyable_v<T>
&& std::is_trivially_destructible_v<T> && std::is_trivially_destructible_v<T>
struct ring_buffer struct RingBuffer
{ {
using u8 = std::uint_least8_t; using u8 = std::uint_least8_t;
using u64 = std::uint_fast64_t; using u64 = std::uint_fast64_t;
using enum std::memory_order; using enum std::memory_order;
binary_ring<u64> _ring; Ring<u64> _ring;
ring_buffer * _next; RingBuffer * _next;
std::atomic<T> * const _array; std::atomic<T> * const _array;
ring_buffer(u8 bits, ring_buffer * next = nullptr) noexcept RingBuffer(u8 bits, RingBuffer * next = nullptr) noexcept
: _ring(bits) : _ring(bits)
, _next(next) , _next(next)
, _array(new std::atomic<T>[this->capacity()]) , _array(new std::atomic<T>[this->capacity()])
{} {}
~ring_buffer() ~RingBuffer()
{ {
delete [] _array; delete [] _array;
if (_next) if (_next)
...@@ -56,7 +56,7 @@ namespace typon::fdt::lock_free ...@@ -56,7 +56,7 @@ namespace typon::fdt::lock_free
return _array[index % _ring].load(relaxed); return _array[index % _ring].load(relaxed);
} }
ring_buffer * fill(ring_buffer * sink, u64 start, u64 end) noexcept RingBuffer * fill(RingBuffer * sink, u64 start, u64 end) noexcept
{ {
for (u64 i = start; i < end; i++) for (u64 i = start; i < end; i++)
{ {
...@@ -65,15 +65,15 @@ namespace typon::fdt::lock_free ...@@ -65,15 +65,15 @@ namespace typon::fdt::lock_free
return sink; return sink;
} }
ring_buffer * grow(u64 start, u64 end) noexcept RingBuffer * grow(u64 start, u64 end) noexcept
{ {
auto buffer = new ring_buffer(std::countr_zero(_ring.size()) + 1, this); auto buffer = new RingBuffer(std::countr_zero(_ring.size()) + 1, this);
return fill(buffer, start, end); return fill(buffer, start, end);
} }
ring_buffer * shrink(u64 start, u64 end) noexcept RingBuffer * shrink(u64 start, u64 end) noexcept
{ {
ring_buffer * last = nullptr; RingBuffer * last = nullptr;
auto next = this; auto next = this;
auto size = (end - start); auto size = (end - start);
auto threshold = size * 2; auto threshold = size * 2;
...@@ -94,4 +94,4 @@ namespace typon::fdt::lock_free ...@@ -94,4 +94,4 @@ namespace typon::fdt::lock_free
} }
#endif // TYPON_FUNDAMENTAL_RINGBUFFER_HPP_INCLUDED #endif // TYPON_RING_BUFFER_HPP_INCLUDED
#ifndef TYPON_CORE_ROOT_HPP_INCLUDED #ifndef TYPON_ROOT_HPP_INCLUDED
#define TYPON_CORE_ROOT_HPP_INCLUDED #define TYPON_ROOT_HPP_INCLUDED
#include <atomic> #include <atomic>
#include <coroutine> #include <coroutine>
#include <cstdint> #include <cstdint>
#include <typon/core/result.hpp> #include <typon/result.hpp>
#include <typon/core/scheduler.hpp> #include <typon/scheduler.hpp>
namespace typon namespace typon
......
#ifndef TYPON_CORE_SCHEDULER_HPP_INCLUDED #ifndef TYPON_SCHEDULER_HPP_INCLUDED
#define TYPON_CORE_SCHEDULER_HPP_INCLUDED #define TYPON_SCHEDULER_HPP_INCLUDED
#include <atomic> #include <atomic>
#include <bit> #include <bit>
...@@ -10,13 +10,12 @@ ...@@ -10,13 +10,12 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include <typon/fundamental/event_count.hpp> #include <typon/continuation.hpp>
#include <typon/fundamental/garbage_collector.hpp> #include <typon/event_count.hpp>
#include <typon/fundamental/random.hpp> #include <typon/garbage_collector.hpp>
#include <typon/pool.hpp>
#include <typon/core/continuation.hpp> #include <typon/random.hpp>
#include <typon/core/pool.hpp> #include <typon/stack.hpp>
#include <typon/core/stack.hpp>
namespace typon namespace typon
...@@ -32,11 +31,11 @@ namespace typon ...@@ -32,11 +31,11 @@ namespace typon
const uint _mask; const uint _mask;
std::atomic<uint> _thieves = 0; std::atomic<uint> _thieves = 0;
std::atomic<u64> _potential = 0; std::atomic<u64> _potential = 0;
fdt::lock_free::event_count<> _notifyer; EventCount<> _notifyer;
std::vector<Pool> _pool; std::vector<Pool> _pool;
std::vector<Stack *> _stack; std::vector<Stack *> _stack;
std::vector<std::thread> _thread; std::vector<std::thread> _thread;
fdt::lock_free::garbage_collector _gc; GarbageCollector _gc;
static inline thread_local uint thread_id; static inline thread_local uint thread_id;
...@@ -177,7 +176,7 @@ namespace typon ...@@ -177,7 +176,7 @@ namespace typon
{ {
continue; continue;
} }
auto index = size > 1 ? fdt::random::random() % size : 0; auto index = size > 1 ? random::random() % size : 0;
auto stack = pool.get(index); auto stack = pool.get(index);
auto state = stack->_state.load(); auto state = stack->_state.load();
if (state == Stack::ACTIVE) if (state == Stack::ACTIVE)
...@@ -249,7 +248,7 @@ namespace typon ...@@ -249,7 +248,7 @@ namespace typon
Pool & random() noexcept Pool & random() noexcept
{ {
return _pool[fdt::random::random() & _mask]; return _pool[random::random() & _mask];
} }
~Scheduler() noexcept ~Scheduler() noexcept
......
...@@ -7,9 +7,8 @@ ...@@ -7,9 +7,8 @@
#include <type_traits> #include <type_traits>
#include <utility> #include <utility>
#include <typon/fundamental/ring_buffer.hpp> #include <typon/continuation.hpp>
#include <typon/ring_buffer.hpp>
#include <typon/core/continuation.hpp>
namespace typon namespace typon
...@@ -17,8 +16,8 @@ namespace typon ...@@ -17,8 +16,8 @@ namespace typon
struct Stack struct Stack
{ {
using ring_buffer = fdt::lock_free::ring_buffer<Continuation *>; using RingBuffer = typon::RingBuffer<Continuation *>;
using u64 = ring_buffer::u64; using u64 = RingBuffer::u64;
using enum std::memory_order; using enum std::memory_order;
...@@ -26,12 +25,12 @@ namespace typon ...@@ -26,12 +25,12 @@ namespace typon
std::atomic<u64> _top {1}; std::atomic<u64> _top {1};
std::atomic<u64> _bottom {1}; std::atomic<u64> _bottom {1};
std::atomic<ring_buffer *> _buffer; std::atomic<RingBuffer *> _buffer;
std::atomic<State> _state; std::atomic<State> _state;
std::coroutine_handle<> _coroutine; std::coroutine_handle<> _coroutine;
Stack(State state) noexcept Stack(State state) noexcept
: _buffer(new ring_buffer(3)) : _buffer(new RingBuffer(3))
, _state(state) , _state(state)
{} {}
...@@ -44,7 +43,7 @@ namespace typon ...@@ -44,7 +43,7 @@ namespace typon
{ {
u64 bottom = _bottom.load(relaxed); u64 bottom = _bottom.load(relaxed);
u64 top = _top.load(acquire); u64 top = _top.load(acquire);
ring_buffer * buffer = _buffer.load(relaxed); RingBuffer * buffer = _buffer.load(relaxed);
if (bottom - top > buffer->capacity() - 1) if (bottom - top > buffer->capacity() - 1)
{ {
buffer = buffer->grow(top, bottom); buffer = buffer->grow(top, bottom);
...@@ -78,7 +77,7 @@ namespace typon ...@@ -78,7 +77,7 @@ namespace typon
Continuation * peek() noexcept Continuation * peek() noexcept
{ {
u64 bottom = _bottom.load(relaxed) - 1; u64 bottom = _bottom.load(relaxed) - 1;
ring_buffer * buffer = _buffer.load(relaxed); RingBuffer * buffer = _buffer.load(relaxed);
return buffer->get(bottom); return buffer->get(bottom);
} }
...@@ -87,7 +86,7 @@ namespace typon ...@@ -87,7 +86,7 @@ namespace typon
u64 top = _top.load(acquire); u64 top = _top.load(acquire);
std::atomic_thread_fence(seq_cst); std::atomic_thread_fence(seq_cst);
u64 bottom = _bottom.load(acquire); u64 bottom = _bottom.load(acquire);
ring_buffer * buffer = _buffer.load(consume); RingBuffer * buffer = _buffer.load(consume);
if (top < bottom) if (top < bottom)
{ {
Continuation * x = buffer->get(top); Continuation * x = buffer->get(top);
...@@ -118,7 +117,7 @@ namespace typon ...@@ -118,7 +117,7 @@ namespace typon
return x; return x;
} }
ring_buffer * reclaim() noexcept RingBuffer * reclaim() noexcept
{ {
u64 bottom = _bottom.load(relaxed); u64 bottom = _bottom.load(relaxed);
u64 top = _top.load(relaxed); u64 top = _top.load(relaxed);
......
#ifndef TYPON_CORE_TASK_HPP_INCLUDED #ifndef TYPON_TASK_HPP_INCLUDED
#define TYPON_CORE_TASK_HPP_INCLUDED #define TYPON_TASK_HPP_INCLUDED
#include <coroutine> #include <coroutine>
#include <utility> #include <utility>
#include <typon/core/result.hpp> #include <typon/result.hpp>
namespace typon namespace typon
......
...@@ -3,13 +3,13 @@ ...@@ -3,13 +3,13 @@
#include <utility> #include <utility>
#include <typon/core/fork.hpp> #include <typon/fork.hpp>
#include <typon/core/forked.hpp> #include <typon/forked.hpp>
#include <typon/core/future.hpp> #include <typon/future.hpp>
#include <typon/core/join.hpp> #include <typon/join.hpp>
#include <typon/core/promise.hpp> #include <typon/promise.hpp>
#include <typon/core/root.hpp> #include <typon/root.hpp>
#include <typon/core/task.hpp> #include <typon/task.hpp>
namespace typon namespace typon
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment