Monitor.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. //
  2. // System.Threading.Monitor.cs
  3. //
  4. // Author:
  5. // Dick Porter ([email protected])
  6. //
  7. // (C) Ximian, Inc. http://www.ximian.com
  8. //
  9. namespace System.Threading
  10. {
  11. public sealed class Monitor
  12. {
  13. public static void Enter(object obj) {
  14. if(obj==null) {
  15. throw new ArgumentNullException("obj");
  16. }
  17. if(obj.GetType().IsValueType==true) {
  18. throw new ArgumentException("Value type");
  19. }
  20. // FIXME
  21. }
  22. public static void Exit(object obj) {
  23. if(obj==null) {
  24. throw new ArgumentNullException("obj");
  25. }
  26. if(obj.GetType().IsValueType==true) {
  27. throw new ArgumentException("Value type");
  28. }
  29. // FIXME
  30. }
  31. public static void Pulse(object obj) {
  32. if(obj==null) {
  33. throw new ArgumentNullException("obj");
  34. }
  35. // FIXME
  36. }
  37. public static void PulseAll(object obj) {
  38. if(obj==null) {
  39. throw new ArgumentNullException("obj");
  40. }
  41. // FIXME
  42. }
  43. public static bool TryEnter(object obj) {
  44. if(obj==null) {
  45. throw new ArgumentNullException("obj");
  46. }
  47. if(obj.GetType().IsValueType==true) {
  48. throw new ArgumentException("Value type");
  49. }
  50. // FIXME
  51. return(false);
  52. }
  53. public static bool TryEnter(object obj, int millisecondsTimeout) {
  54. if(obj==null) {
  55. throw new ArgumentNullException("obj");
  56. }
  57. if(obj.GetType().IsValueType==true) {
  58. throw new ArgumentException("Value type");
  59. }
  60. if(millisecondsTimeout<0) {
  61. throw new ArgumentException("millisecondsTimeout negative");
  62. }
  63. // FIXME
  64. return(false);
  65. }
  66. public static bool TryEnter(object obj, TimeSpan timeout) {
  67. if(obj==null) {
  68. throw new ArgumentNullException("obj");
  69. }
  70. if(obj.GetType().IsValueType==true) {
  71. throw new ArgumentException("Value type");
  72. }
  73. if(timeout.Milliseconds < 0 || timeout.Milliseconds > Int32.MaxValue) {
  74. throw new ArgumentOutOfRangeException("timeout out of range");
  75. }
  76. // FIXME
  77. return(false);
  78. }
  79. public static bool Wait(object obj) {
  80. if(obj==null) {
  81. throw new ArgumentNullException("obj");
  82. }
  83. // FIXME
  84. return(false);
  85. }
  86. public static bool Wait(object obj, int millisecondsTimeout) {
  87. if(obj==null) {
  88. throw new ArgumentNullException("obj");
  89. }
  90. // FIXME
  91. return(false);
  92. }
  93. public static bool Wait(object obj, TimeSpan timeout) {
  94. if(obj==null) {
  95. throw new ArgumentNullException("obj");
  96. }
  97. // LAMESPEC: says to throw ArgumentException too
  98. if(timeout.Milliseconds < 0 || timeout.Milliseconds > Int32.MaxValue) {
  99. throw new ArgumentOutOfRangeException("timeout out of range");
  100. }
  101. // FIXME
  102. return(false);
  103. }
  104. public static bool Wait(object obj, int millisecondsTimeout, bool exitContext) {
  105. if(obj==null) {
  106. throw new ArgumentNullException("obj");
  107. }
  108. // FIXME
  109. return(false);
  110. }
  111. public static bool Wait(object obj, TimeSpan timeout, bool exitContext) {
  112. if(obj==null) {
  113. throw new ArgumentNullException("obj");
  114. }
  115. // LAMESPEC: says to throw ArgumentException too
  116. if(timeout.Milliseconds < 0 || timeout.Milliseconds > Int32.MaxValue) {
  117. throw new ArgumentOutOfRangeException("timeout out of range");
  118. }
  119. // FIXME
  120. return(false);
  121. }
  122. }
  123. }