From 4fa33bdc60e4bb196294c3bb4268e4199794d2b5 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 9 Mar 2018 17:43:49 -0800 Subject: [PATCH] Revert "ircd::ctx: Add nodejs-style future::then() rather than libstd experimental TS." This reverts commit 37569559cf26275d385861f57c0dbfce9f5939d5. --- include/ircd/ctx/future.h | 19 ------------------- include/ircd/ctx/promise.h | 20 -------------------- include/ircd/ctx/shared_state.h | 3 --- 3 files changed, 42 deletions(-) diff --git a/include/ircd/ctx/future.h b/include/ircd/ctx/future.h index ebed419a7..42ad58832 100644 --- a/include/ircd/ctx/future.h +++ b/include/ircd/ctx/future.h @@ -58,8 +58,6 @@ class ircd::ctx::future T get(); operator T() { return get(); } - void then(decltype(shared_state::callback)); - future(); future(promise &promise); }; @@ -84,8 +82,6 @@ class ircd::ctx::future template future_status wait(const duration &d) const; void wait() const; - void then(decltype(shared_state::callback)); - future(); future(promise &promise); }; @@ -140,21 +136,6 @@ ircd::ctx::future::future(promise &promise) { } -template -void -ircd::ctx::future::then(decltype(shared_state::callback) cb) -{ - assert(valid()); - st->callback = std::move(cb); -} - -inline void -ircd::ctx::future::then(decltype(shared_state::callback) cb) -{ - assert(valid()); - st->callback = std::move(cb); -} - template T ircd::ctx::future::get() diff --git a/include/ircd/ctx/promise.h b/include/ircd/ctx/promise.h index 74f8e5c59..c38ddb2fd 100644 --- a/include/ircd/ctx/promise.h +++ b/include/ircd/ctx/promise.h @@ -147,10 +147,6 @@ ircd::ctx::promise::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::set_value() assert(!finished()); st->finished = true; st->cond.notify_all(); - if(st->callback) ircd::post([st(st)] - { - st->callback(st->eptr); - }); } template @@ -175,10 +167,6 @@ ircd::ctx::promise::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::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 @@ -204,8 +188,4 @@ ircd::ctx::promise::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); - }); } diff --git a/include/ircd/ctx/shared_state.h b/include/ircd/ctx/shared_state.h index 58d751cf8..e9d422777 100644 --- a/include/ircd/ctx/shared_state.h +++ b/include/ircd/ctx/shared_state.h @@ -36,7 +36,6 @@ struct ircd::ctx::shared_state using reference_type = T &; T val; - std::function callback; std::shared_ptr> share() const; std::shared_ptr> share(); @@ -49,8 +48,6 @@ struct ircd::ctx::shared_state { using value_type = void; - std::function callback; - std::shared_ptr> share() const; std::shared_ptr> share(); };