MessageQueue Class |
Namespace: AGI.Foundation.Infrastructure.Threading
The MessageQueue type exposes the following members.
Name | Description | |
---|---|---|
MessageQueue | Initializes a new instance. |
Name | Description | |
---|---|---|
MaximumQueueLength |
Gets or sets the maximum number of items that is allowed in the queue.
If a thread attempts to add an item to a full queue, it will block until room is available in the queue.
|
Name | Description | |
---|---|---|
Dispose |
Releases any resources associated with this instance.
| |
Dispose(Boolean) |
Releases any resources associated with this instance.
| |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
Post(Object) |
Adds a generic message to the message queue
that is asynchronously sent to any functions that subscribe to MessageReceived.
| |
Post(SendOrPostCallback, Object) |
Adds a delegate to the message queue and immediately returns.
| |
Send(Object) |
Adds a generic message to the message queue
that is synchronously sent to any functions that subscribe to MessageReceived.
| |
Send(SendOrPostCallback, Object) |
Adds a delegate to the message queue and waits until all currently
queued messages and the given delegate are executed before returning.
| |
Start |
Runs the message queue in the current thread and does not return until Terminate is called.
| |
StartInAnotherThread |
Runs the message queue in a separate thread and immediately returns.
This method calls StartInThreadPoolThread or StartInNewThread
depending on the value of ThreadSource in the ThreadingPolicy.
| |
StartInNewThread |
Runs the message queue in a newly spawned worker thread and immediately returns.
The worker thread will not be terminated until Terminate is called.
| |
StartInNewThread(String) |
Runs the message queue in a newly spawned worker thread and immediately returns.
The worker thread will not be terminated until Terminate is called.
| |
StartInThreadPoolThread |
Runs the message queue in a thread pool thread and immediately returns.
The worker thread will not be released back to the thread pool until Terminate is called.
| |
Terminate | Terminates the message queue. Any messages that are already in the queue when this method is called will be processed before the queue is terminated. This method initiates the termination and returns immediately; it does NOT wait for the termination to complete before returning. It is safe to call this method from any thread, including the thread that is processing the message queue. To wait for termination to complete, call TerminateAndWait instead. If the queue is not running when this method is called, the termination request will still be posted. That means that queue processing, once restarted, will terminate once it reaches this point in the queue. | |
TerminateAndWait | Terminates the message queue and waits for termination to complete. Any messages that are already in the queue when this method is called will be processed before the queue is terminated. Unlike Terminate, this method does not return until the message queue is terminated. This method must not be called from the thread that is running the message queue. Doing so will cause a deadlock, because this method cannot return until the message queue terminates, and the queue cannot terminate until this method returns. | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
MessageQueueStarted |
Event that indicates MessageQueue has started to receive messages. If MessageQueue was
started with a call to StartInAnotherThread, this event will be raised in that other thread.
| |
MessageQueueStopped |
Event that indicates MessageQueue has been stopped by a call to Terminate. If MessageQueue was
started with a call to StartInAnotherThread, this event will be raised in that other thread.
| |
MessageReceived |
Event that indicates a generic message object was received. If MessageQueue was
started with a call to StartInAnotherThread, this event will be raised in that other thread.
|