Document await that it will never return if shutdown-agents was called

Description

Undocumented behavior or the "await" function: it will never return if shutdown-agents was called.

This was a surprise to me to find yet another condition when await never returns.

(def my-agent (agent 0)) (defn sleep-and-inc [number] (Thread/sleep 3000) (println "action number" number "complete") (inc number)) (println "sending off 2 times") (send-off my-agent sleep-and-inc) (send-off my-agent sleep-and-inc) (println "sending off complete") ;making sure all the actions have completed to make it simple, ;otherwise only the first action will be executed (Thread/sleep 7000) (shutdown-agents) (println "starting await") (await my-agent) (println "await complete");this will never happen ;here is how it behaves: ;sending off 2 times ;sending off complete ;action number 0 complete ;action number 1 complete ;starting await ;...hanging forever...

Proposal: Change the docstring for clojure.core/await from "...Will never return if a failed agent is restarted with :clear-actions true." to
"...Will never return if a failed agent is restarted with :clear-actions true or shutdown-agents was called."

Patch: CLJ-1918.patch

Prescreened by: Alex Miller

Environment

None

Attachments

1
  • 25 Apr 2016, 03:12 PM

Activity

Show:
Completed

Details

Assignee

Reporter

Approval

Ok

Patch

Code

Priority

Affects versions

Fix versions

Created April 25, 2016 at 2:43 PM
Updated September 7, 2017 at 8:46 PM
Resolved September 7, 2017 at 8:46 PM

Flag notifications