March 2004
Intermediate to advanced
560 pages
26h 47m
English
using System; using System.Threading; namespace Samples { public class MyIAsyncResultSample { internal class MyIAsyncResult: IAsyncResult { internal Object stateObject; internal bool complete = false; internal AutoResetEvent jobDone; internal MyIAsyncResult(Object stateObject) { this.stateObject = stateObject; this.jobDone = new AutoResetEvent(false); } public virtual Object AsyncState {get { return stateObject; }} public bool IsCompleted { get {return complete; }} public WaitHandle AsyncWaitHandle {get {return jobDone; }} public bool CompletedSynchronously {get {return false; }} } internal class RandomNumberProvider { private static Random r = new Random(); private void FillWithRandoms(object o) { MyIAsyncResult m = (MyIAsyncResult) ...Read now
Unlock full access