mirror of
https://github.com/matrix-construct/construct
synced 2024-09-29 20:28:52 +02:00
Revert "ircd::ctx: Add nodejs-style future::then() rather than libstd experimental TS."
This reverts commit 37569559cf
.
This commit is contained in:
parent
28c7826032
commit
4fa33bdc60
3 changed files with 0 additions and 42 deletions
|
@ -58,8 +58,6 @@ class ircd::ctx::future
|
|||
T get();
|
||||
operator T() { return get(); }
|
||||
|
||||
void then(decltype(shared_state<T>::callback));
|
||||
|
||||
future();
|
||||
future(promise<T> &promise);
|
||||
};
|
||||
|
@ -84,8 +82,6 @@ class ircd::ctx::future<void>
|
|||
template<class duration> future_status wait(const duration &d) const;
|
||||
void wait() const;
|
||||
|
||||
void then(decltype(shared_state<void>::callback));
|
||||
|
||||
future();
|
||||
future(promise<void> &promise);
|
||||
};
|
||||
|
@ -140,21 +136,6 @@ ircd::ctx::future<T>::future(promise<T> &promise)
|
|||
{
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void
|
||||
ircd::ctx::future<T>::then(decltype(shared_state<T>::callback) cb)
|
||||
{
|
||||
assert(valid());
|
||||
st->callback = std::move(cb);
|
||||
}
|
||||
|
||||
inline void
|
||||
ircd::ctx::future<void>::then(decltype(shared_state<void>::callback) cb)
|
||||
{
|
||||
assert(valid());
|
||||
st->callback = std::move(cb);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
T
|
||||
ircd::ctx::future<T>::get()
|
||||
|
|
|
@ -147,10 +147,6 @@ ircd::ctx::promise<T>::set_value(T&& val)
|
|||
st->val = std::move(val);
|
||||
st->finished = true;
|
||||
st->cond.notify_all();
|
||||
if(st->callback) ircd::post([st(st)]
|
||||
{
|
||||
st->callback(st->eptr, st->val);
|
||||
});
|
||||
}
|
||||
|
||||
inline void
|
||||
|
@ -160,10 +156,6 @@ ircd::ctx::promise<void>::set_value()
|
|||
assert(!finished());
|
||||
st->finished = true;
|
||||
st->cond.notify_all();
|
||||
if(st->callback) ircd::post([st(st)]
|
||||
{
|
||||
st->callback(st->eptr);
|
||||
});
|
||||
}
|
||||
|
||||
template<class T>
|
||||
|
@ -175,10 +167,6 @@ ircd::ctx::promise<T>::set_value(const T &val)
|
|||
st->val = val;
|
||||
st->finished = true;
|
||||
st->cond.notify_all();
|
||||
if(st->callback) ircd::post([st(st)]
|
||||
{
|
||||
st->callback(st->eptr, st->val);
|
||||
});
|
||||
}
|
||||
|
||||
inline void
|
||||
|
@ -189,10 +177,6 @@ ircd::ctx::promise<void>::set_exception(std::exception_ptr eptr)
|
|||
st->eptr = std::move(eptr);
|
||||
st->finished = true;
|
||||
st->cond.notify_all();
|
||||
if(st->callback) ircd::post([st(st)]
|
||||
{
|
||||
st->callback(st->eptr);
|
||||
});
|
||||
}
|
||||
|
||||
template<class T>
|
||||
|
@ -204,8 +188,4 @@ ircd::ctx::promise<T>::set_exception(std::exception_ptr eptr)
|
|||
st->eptr = std::move(eptr);
|
||||
st->finished = true;
|
||||
st->cond.notify_all();
|
||||
if(st->callback) ircd::post([st(st)]
|
||||
{
|
||||
st->callback(st->eptr, st->val);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@ struct ircd::ctx::shared_state
|
|||
using reference_type = T &;
|
||||
|
||||
T val;
|
||||
std::function<void (std::exception_ptr, T) noexcept> callback;
|
||||
|
||||
std::shared_ptr<const shared_state<T>> share() const;
|
||||
std::shared_ptr<shared_state<T>> share();
|
||||
|
@ -49,8 +48,6 @@ struct ircd::ctx::shared_state<void>
|
|||
{
|
||||
using value_type = void;
|
||||
|
||||
std::function<void (std::exception_ptr) noexcept> callback;
|
||||
|
||||
std::shared_ptr<const shared_state<void>> share() const;
|
||||
std::shared_ptr<shared_state<void>> share();
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue