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?

상속: ARef
예제 #1
0
 /// <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;
 }
예제 #2
0
 public IRef removeWatch(Agent watcher)
 {
     _watchers = _watchers.without(watcher);
      return this;
 }
예제 #3
0
 public IRef addWatch(Agent watcher, IFn action, bool sendOff)
 {
     _watchers = _watchers.assoc(watcher, new object[] { action, sendOff });
      return this;
 }
예제 #4
0
 /// <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);
 }