close

open override fun close()(source)

Closes this observation exactly once.

The source cleanup callback runs at most once and runs synchronously on the first caller. Other callers wait for it to finish. A cleanup failure without re-entry is propagated unchanged by this and every later call. Re-entry from the cleanup callback is rejected instead of deadlocking. The re-entry failure becomes primary even when cleanup catches it, and any distinct failure subsequently thrown by cleanup is suppressed on it. A successful return guarantees that the source can start no further callback for this subscription, although a callback already in progress may finish.

Throws

when source cleanup fails.