Results 125 comments of Lewis Baker

The Coroutines TS provides the ability to customise the allocation strategy by overloading `operator new` on the promise type of the coroutine. I'll cover this in a bit more detail...

@skgbanga Where the nested coroutine-frame is placed in the caller's activation frame depends on the whether or not the caller is a coroutine or a normal function and if it's...

@danghvu Great questions! > What is the memory usage of a coroutine? The size of the coroutine frame is highly dependent on the coroutine body, type of coroutine as well...

@danghvu The `coroutine_handle` of the suspended coroutine is passed to the `await_suspend()` call of the awaitable object. The implementation of that method can store the coroutine handle wherever is most...

@breathe67 Yes, that's right. If you pass a pointer or reference to a value owned by the caller into a coroutine then you need to be aware that the coroutine...

@ioquatix I've been thinking about just making a separate post listing some useful coroutine resources. I'll make sure to include that link in there. @JimViebke I'll try to include more...

@crusader-mike Thanks for the feedback and the great questions. 1. It's true that calls to a coroutine function may throw `std::bad_alloc`. This would be no diffierent to, say, calling a...

> Stack (usually, AFAIK) grows "backwards" so you decrement the pointer to allocate space and increment to free it. Yes, you are right. On most architectures the stack grows backwards....

> when are senders awaitables, and when do I need to schedule the senders on some scheduler? A sender is awaitable within a coroutine when the context provided by that...

Yes, I think this could be part of the type-erasing wrapper, but that would forward the non-`exception_ptr` error into another customisation point, like `get_exception_ptr(err)`, that allowed you to customise how...