@@ -270,17 +270,6 @@ public:
270270 }
271271 }
272272
273- /* *
274- * @brief Unsafe cancel will cancel a context's async operation
275- *
276- * This operation is labelled as "unsafe" because it this API does not update
277- * the top level future<T> object that was initially bound to this context,
278- * to the "cancelled" state. Because of this, using/accessing that future<T>
279- * in anyway is considered UB.
280- *
281- */
282- void unsafe_cancel ();
283-
284273 [[nodiscard]] constexpr auto memory_used () const noexcept
285274 {
286275 return m_stack_pointer - m_stack.data ();
@@ -1029,21 +1018,6 @@ public:
10291018 return *this ;
10301019 }
10311020
1032- void cancel ()
1033- {
1034- // TODO(#37): consider if cancel should check the context state for blocked
1035- // by io or external and skip cancellation if thats the case.
1036- if (std::holds_alternative<handle_type>(m_state)) {
1037- std::get<handle_type>(m_state).destroy ();
1038- }
1039- m_state = cancelled_state{};
1040- }
1041-
1042- bool is_cancelled ()
1043- {
1044- return std::holds_alternative<cancelled_state>(m_state);
1045- }
1046-
10471021 constexpr ~future ()
10481022 {
10491023 if (std::holds_alternative<handle_type>(m_state)) {
@@ -1084,27 +1058,4 @@ constexpr future<T> promise<T>::get_return_object() noexcept
10841058 m_context->active_handle (handle);
10851059 return future<T>{ handle };
10861060}
1087-
1088- void context::unsafe_cancel ()
1089- {
1090- // TODO(#38): Consider if a safe variant of cancel is achievable
1091- if (m_active_handle == std::noop_coroutine ()) {
1092- return ;
1093- }
1094-
1095- auto index = m_active_handle;
1096-
1097- while (true ) {
1098- using base_handle = std::coroutine_handle<promise_base>;
1099- auto top = base_handle::from_address (index.address ());
1100- auto continuation = top.promise ().m_continuation ;
1101- if (continuation == std::noop_coroutine ()) {
1102- // We have found our top level coroutine
1103- top.destroy ();
1104- m_stack_pointer = m_stack.data ();
1105- return ;
1106- }
1107- index = continuation;
1108- }
1109- }
11101061} // namespace async::inline v0
0 commit comments