Closed
Description
9f287c2 added ref counting for tasks blocking on pipes to avoid a race that happens during shutdown. This should only be necessary in the select case. When receiving from one pipe, the receiver will definitely block, so we don't have to worry about it shutting down before the sender wakes it up.
I propose using the low bit of the task pointer that goes in the packet header to indicate whether it is a strong or weak reference. The sender is responsible for dropping strong references, but not weak ones, since the receiver won't increment the task ref count when it stores a weak reference.
The rule would then be to use a strong reference in select (via mark_blocked
), and use a weak reference for receive.