You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
coroutine: allocate coroutine frame in a critical section
Like continuations, coroutines are glue that cannot be allowed
to fail. For example, if cleanup coroutine fails to allocate
and returns an exception future, cleanup will not be done and
the system will enter an undefined state. Better to crash.
This conflicts with test code that tries to inject memory failures
and see how they are handled (file_io_test.cc handle_bad_alloc_test).
The coroutine will throw std::bad_alloc (since we don't define
get_return_object_on_allocation_failure()), and since it's declared
noexcept, will call std::terminate.
To avoid all this, follow future::schedule() and prevent memory
allocation failure injection from interfering with coroutine
frame allocation. In this regard a coroutine frame is just like
a continuation.
This is done by injecting class-specific operator new and operator
delete. Sized deallocation is also defined if supported by the compiler.
0 commit comments