https://toitlang.org/ logo
Keep track of the task, and then use a `finally` t...
# general
f
Keep track of the task, and then use a
finally
to unsubscribe:
Copy code
reader-task := task::
  ch.subscribe
  try:
    while true:
      incoming := ch.wait-for-notification
  finally:
    ch.unsubscribe
...
// Cleanup.
reader-task.cancel