Commit 15018887 authored by Xavier Thompson's avatar Xavier Thompson

Rename Future into Promise

parent cac8fac3
#ifndef TYPON_CORE_FUTURE_HPP_INCLUDED #ifndef TYPON_CORE_PROMISE_HPP_INCLUDED
#define TYPON_CORE_FUTURE_HPP_INCLUDED #define TYPON_CORE_PROMISE_HPP_INCLUDED
#include <atomic> #include <atomic>
#include <cstdint> #include <cstdint>
...@@ -16,7 +16,7 @@ namespace typon ...@@ -16,7 +16,7 @@ namespace typon
{ {
template <typename T> template <typename T>
struct Future struct Promise
{ {
static constexpr std::uintptr_t ready {0}; static constexpr std::uintptr_t ready {0};
static constexpr std::uintptr_t no_waiter {1}; static constexpr std::uintptr_t no_waiter {1};
...@@ -28,7 +28,7 @@ namespace typon ...@@ -28,7 +28,7 @@ namespace typon
T _value; T _value;
}; };
~Future() ~Promise()
{ {
if (!_consumed) if (!_consumed)
{ {
...@@ -75,7 +75,7 @@ namespace typon ...@@ -75,7 +75,7 @@ namespace typon
template <typename T> template <typename T>
requires std::is_trivially_destructible_v<T> requires std::is_trivially_destructible_v<T>
struct Future<T> struct Promise<T>
{ {
static constexpr std::uintptr_t ready {0}; static constexpr std::uintptr_t ready {0};
static constexpr std::uintptr_t no_waiter {1}; static constexpr std::uintptr_t no_waiter {1};
...@@ -119,7 +119,7 @@ namespace typon ...@@ -119,7 +119,7 @@ namespace typon
template <typename T> template <typename T>
struct Future<T&> struct Promise<T&>
{ {
static constexpr std::uintptr_t ready {0}; static constexpr std::uintptr_t ready {0};
static constexpr std::uintptr_t no_waiter {1}; static constexpr std::uintptr_t no_waiter {1};
...@@ -160,7 +160,7 @@ namespace typon ...@@ -160,7 +160,7 @@ namespace typon
template <> template <>
struct Future<void> struct Promise<void>
{ {
static constexpr std::uintptr_t ready {0}; static constexpr std::uintptr_t ready {0};
static constexpr std::uintptr_t no_waiter {1}; static constexpr std::uintptr_t no_waiter {1};
...@@ -197,4 +197,4 @@ namespace typon ...@@ -197,4 +197,4 @@ namespace typon
} }
#endif // TYPON_CORE_FUTURE_HPP_INCLUDED #endif // TYPON_CORE_PROMISE_HPP_INCLUDED
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
#include <typon/core/fork.hpp> #include <typon/core/fork.hpp>
#include <typon/core/forked.hpp> #include <typon/core/forked.hpp>
#include <typon/core/future.hpp>
#include <typon/core/join.hpp> #include <typon/core/join.hpp>
#include <typon/core/promise.hpp>
#include <typon/core/root.hpp> #include <typon/core/root.hpp>
#include <typon/core/task.hpp> #include <typon/core/task.hpp>
......
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