3 ms·
Not necessarily, I already explained how (resource binding). Close the socket, all handlers are cancelled, context can be freed immediately. The socket owns th
by mgaunard 7mo ago
Not necessarily, I already explained how (resource binding).
Close the socket, all handlers are cancelled, context can be freed immediately. The socket owns the data.
- spacechild1 7mo ago> The socket owns the data. What if there's more than one socket involved?
- mgaunard 7mo agoThen you have it owned by the parent which owns all relevant sockets. Resource ownership management 101.
- spacechild1 7mo agoBut that's not what you want. The context object should be freed when the associated operation finishes (either successfully or with an error), not when the parent goes out of scope. With coroutines I can simply put the context object on the stack and when the task finishes, the object automatically goes out of scope.