Open lewissbaker opened 4 months ago
do you agree that the operation state takes ownership of the receiver? and that the receiver's environment is the environment of the operation?
Do you agree that the operation state takes ownership of the receiver? and that the receiver's environment is the environment of the operation?
I agree that the operation-state takes ownership of the receiver, and I agree that the environment obtained from the receiver is the environment that is provided to the operation.
However, both the receiver and the environment have handle semantics and they do not necessarily confer ownership of the resulting environment.
I can obtain many instances of the environment queryable object, all of which refer to the same logical environment, by calling rcvr.get_env()
multiple times. The storage for values backing an environment's queries are generally (at least in all of the implementations of senders that I've written) provided by the parent operation-states. The environment just holds a pointer to the parent-op-state (just as the receiver holds a pointer to the parent op-state). Destroying the child op-state does not destroy the environment or its values.
I don't think it helps to say that a child operation state "owns" its environment.
A resolution to this issue has been proposed in https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3396r0.html
The wording of P2300R10
[async.ops]
p4 states:The last sentence doesn't quite seem right to me.
An operation's associated environment is provided to it by its caller via the receiver. An operation therefore does not really "own" its own environment, but rather is provided access to the environment by its caller.
Can we just strike this sentence from here?