2 // System.IO/FileStreamAsyncResult.cs
5 // Gonzalo Paniagua Javier (gonzalo@ximian.com)
7 // (c) 2004 Novell, Inc. (http://www.novell.com)
10 using System.Threading;
14 class FileStreamAsyncResult : IAsyncResult {
15 /* Same structure in the runtime */
24 public byte [] Buffer;
27 public int OriginalCount;
32 public FileStreamAsyncResult (AsyncCallback cb, object state)
37 this.cb = new AsyncCallback (CBWrapper);
38 wh = new ManualResetEvent (false);
41 static void CBWrapper (IAsyncResult ares)
43 FileStreamAsyncResult res = (FileStreamAsyncResult) ares;
44 res.realcb.BeginInvoke (ares, null, null);
47 public void SetComplete (Exception e)
54 public void SetComplete (Exception e, int nbytes)
56 this.BytesRead = nbytes;
60 public void SetComplete (Exception e, int nbytes, bool synch)
62 completedSynch = synch;
63 SetComplete (e, nbytes);
66 public object AsyncState {
70 public bool CompletedSynchronously {
71 get { return completedSynch; }
74 public WaitHandle AsyncWaitHandle {
78 public bool IsCompleted {
79 get { return completed; }
82 public Exception Exception {