Represents an Agent.

See the Clojure documentation for more information.

The Java implementation plays many more games with thread pools. The CLR does not provide such support. We need to revisit this in CLR 4. Until then: TODO: Implement our own thread pooling?

Inheritance: ARef
 /// <summary>
 /// Create an encapsulated message to an agent.
 /// </summary>
 /// <param name="agent">The agent the message is for.</param>
 /// <param name="fn">The function to compute the new value.</param>
 /// <param name="args">Additional arguments (in addition to the current state).</param>
 /// <param name="solo">Execute on its own thread?</param>
 public Action(Agent agent, IFn fn, ISeq args, bool solo)
 {
     _agent = agent;
     _fn = fn;
     _args = args;
     _solo = solo;
 }
Exemple #2
0
 public IRef removeWatch(Agent watcher)
 {
     _watchers = _watchers.without(watcher);
      return this;
 }
Exemple #3
0
 public IRef addWatch(Agent watcher, IFn action, bool sendOff)
 {
     _watchers = _watchers.assoc(watcher, new object[] { action, sendOff });
      return this;
 }
 /// <summary>
 /// Add an agent action sent during the transaction to a queue.
 /// </summary>
 /// <param name="action">The action that was sent.</param>
 internal void Enqueue(Agent.Action action)
 {
     _actions.Add(action);
 }