C# 클래스 clojure.lang.Agent

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
파일 보기 프로젝트 열기: arohner/clojure-contrib 1 사용 예제들

공개 메소드들

메소드 설명
AddError ( Exception e ) : void

Add an error.

Agent ( Object state, IPersistentMap meta ) : System

Construct an agent with given state and metadata.

Agent ( object state ) : System

Construct an agent with given state and null metadata.

clearErrors ( ) : void

Clear the agent's errors.

Lowercase-name and for core.clj compatibility.

deref ( ) : object

Gets the (immutable) value the reference is holding.

dispatch ( IFn fn, ISeq args, System.Boolean solo ) : object

Send a message to the agent.

getErrors ( ) : ISeq

Get the agent's errors.

Lowercase-name (and is a method instead of a property) for core.clj compatibility.

releasePendingSends ( ) : int

Enqueue nested actions.

lowercase for core.clj compatibility

shutdown ( ) : void

Shutdown all threads executing.

We need to work on this.

비공개 메소드들

메소드 설명
DispatchAction ( System.Action action ) : void

Send an action (encapsulated message).

If there is a transaction running on this thread, defer execution until the transaction ends (enqueue the action on the transaction).

If there is already an action running, enqueue it (nested).

Otherwise, queue it for execution.

Enqueue ( System.Action action ) : void

Enqueue an action in the pending queue.

Spin-locks to update the queue.

SetState ( object newState ) : bool

Set the state.

메소드 상세

AddError() 공개 메소드

Add an error.
public AddError ( Exception e ) : void
e System.Exception The exception to add.
리턴 void

Agent() 공개 메소드

Construct an agent with given state and metadata.
public Agent ( Object state, IPersistentMap meta ) : System
state Object The initial state.
meta IPersistentMap The metadata to attach.
리턴 System

Agent() 공개 메소드

Construct an agent with given state and null metadata.
public Agent ( object state ) : System
state object The initial state.
리턴 System

clearErrors() 공개 메소드

Clear the agent's errors.
Lowercase-name and for core.clj compatibility.
public clearErrors ( ) : void
리턴 void

deref() 공개 메소드

Gets the (immutable) value the reference is holding.
public deref ( ) : object
리턴 object

dispatch() 공개 메소드

Send a message to the agent.
public dispatch ( IFn fn, ISeq args, System.Boolean solo ) : object
fn IFn The function to be called on the current state and the supplied arguments.
args ISeq The extra arguments to the function.
solo System.Boolean true means execute on its own thread (send-off); /// false means use a thread pool thread (send).
리턴 object

getErrors() 공개 메소드

Get the agent's errors.
Lowercase-name (and is a method instead of a property) for core.clj compatibility.
public getErrors ( ) : ISeq
리턴 ISeq

releasePendingSends() 공개 정적인 메소드

Enqueue nested actions.
lowercase for core.clj compatibility
public static releasePendingSends ( ) : int
리턴 int

shutdown() 공개 정적인 메소드

Shutdown all threads executing.
We need to work on this.
public static shutdown ( ) : void
리턴 void