Ref Type: Agent
is a reference type which is shared, asynchronous, and autonomous:
- shared - multiple threads can share access
- asynchronous - changes may not occur immediately
- autonomous - changes are made to a single item
Example: Add 1 to
, at some point in the future.
In Clojure (unlike Elixir
agents are reactive: there is no imperative message loop and no blocking receive.
"CC" links to the official Clojure documentation; "CD" links to ClojureDocs.
- add-watch (CC, CD) - adds a watch function to an Agent
- agent (CC, CD) - creates and returns an Agent
- agent-error (CC, CD) - returns any exception thrown by an Agent
- deref (CC, CD) - returns the current state of an Agent
- restart-agent (CC, CD) - restarts a failing Agent
- send (CC, CD) - dispatches an action to an Agent (thread pool)
- send-off (CC, CD) - dispatches an action to an Agent (sep. thread)
- set-validator! (CC, CD) - sets the
validator-fn for an Agent
- shutdown-agents (CC, CD) - shuts down the Agent system's thread pools
To be continued...
This wiki page is maintained by Rich Morin
an independent consultant specializing in software design, development, and documentation.
Please feel free to email
comments, inquiries, suggestions, etc!