HttpAsyncResult.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. //
  2. // System.Web.HttpAsyncResult
  3. //
  4. // Author:
  5. // Patrik Torstensson ([email protected])
  6. //
  7. using System;
  8. using System.Threading;
  9. namespace System.Web
  10. {
  11. internal class HttpAsyncResult : IAsyncResult
  12. {
  13. private object _result;
  14. private object _asyncState;
  15. private AsyncCallback _callback;
  16. private Exception _error;
  17. private bool _ready;
  18. private bool _readySync;
  19. internal HttpAsyncResult(AsyncCallback callback, object state) {
  20. _callback = callback;
  21. _asyncState = state;
  22. }
  23. internal void Complete(bool sync, object result, Exception error) {
  24. _ready = true;
  25. _readySync = sync;
  26. _result = result;
  27. _error = error;
  28. if (null != _callback) {
  29. _callback(this);
  30. }
  31. }
  32. internal Exception Error {
  33. get {
  34. return null;
  35. }
  36. }
  37. public object AsyncState {
  38. get {
  39. return _asyncState;
  40. }
  41. }
  42. public object AsyncObject {
  43. get {
  44. return null;
  45. }
  46. }
  47. public WaitHandle AsyncWaitHandle {
  48. get {
  49. return null;
  50. }
  51. }
  52. public bool CompletedSynchronously {
  53. get {
  54. return _readySync;
  55. }
  56. }
  57. public bool IsCompleted {
  58. get {
  59. return _ready;
  60. }
  61. }
  62. }
  63. }