Add public channel "closed?" predicate

Description

Current patch file: 0002-ASYNC-126-Add-public-channel-closed-predicate.patch

Add a public function closed? in clojure.core.async to determine if a channel is closed without putting or taking any values.

This is a trivial wrapper around clojure.core.async.impl.protocols/closed?

There is still a race between closed? and close!. Correct code should never rely on closed? to check that a channel is open. The closed? predicate should only be used to avoid extra work producing a value for a closed channel.

Example use case

A producer process can check if a channel is closed? before doing the work to produce the next value.

Environment

None

Assignee

Stuart Sierra

Reporter

Stuart Sierra

Labels

None

Approval

Triaged

Patch

Code

Priority

Major
Configure