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
The correct way to implement 'cancelling the parent from a child'. Instead of passing in the cancel func from parent to child, the parent listens on a specific cancellation channel. The parent passes the channel to the child. Each time the child attempts to send an output to the output channel, it does so with a newly create time-out context. If that time-out occurs, then the child sends a cancellation notification on the cancel channel. The parent on seeing this cancelation request will invoke cancel on the context, resulting in the entire worker-pool shutting down.
The correct way to implement 'cancelling the parent from a child'. Instead of passing in the cancel func from parent to child, the parent listens on a specific cancellation channel. The parent passes the channel to the child. Each time the child attempts to send an output to the output channel, it does so with a newly create time-out context. If that time-out occurs, then the child sends a cancellation notification on the cancel channel. The parent on seeing this cancelation request will invoke cancel on the context, resulting in the entire worker-pool shutting down.
See:
The text was updated successfully, but these errors were encountered: