Deferred Class |
Namespace: Telogis.GeoBase.Concurrency
The Deferred type exposes the following members.
Name | Description | |
---|---|---|
BeginWait |
Waits asynchronously for the event to complete.
| |
Defer(DeferredDeferredAction) |
Invokes an action when the event occurs.
If the event has already occurred action is invoked synchronously.
| |
Defer(DeferredExceptionHandler, DeferredDeferredAction) |
Invokes an action when the event occurs.
If the event has already occurred action is invoked synchronously.
| |
DeferAlways(DeferredDeferredAction) |
Invokes an action once when the event reoccurs.
| |
DeferAlways(DeferredExceptionHandler, DeferredDeferredAction) |
Invokes an action once when the event reoccurs.
| |
EndWait |
Blocks until the event occurs.
Returns immediately if the event has already occurred.
| |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
Set |
Raises the event and synchronously invokes all waiting callbacks.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
Wait |
Blocks until the event occurs.
Returns immediately if the event has already occurred.
|
class DirectionsCalculator { private Directions directions; private AsyncEvent readyEvent = new AsyncEvent(); public DirectionsCalculator(Route route) { Thread thread = new Thread(() => { directions = route.GetDirections(); readyEvent.Set(); }); thread.Start(); } public IAsyncResult GetDirections(AsyncCallback callback, object state) { return readyEvent.BeginWait(callback, state); } public Directions EndGetDirections(IAsyncResult result) { readyEvent.EndWait(result); return directions; } }