ManualResetEvent.cs 716 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //
  2. // System.Threading.ManualResetEvent.cs
  3. //
  4. // Author:
  5. // Dick Porter ([email protected])
  6. // Veronica De Santis ([email protected])
  7. //
  8. // (C) Ximian, Inc. http://www.ximian.com
  9. //
  10. using System;
  11. using System.Runtime.CompilerServices;
  12. namespace System.Threading
  13. {
  14. public sealed class ManualResetEvent : WaitHandle
  15. {
  16. // Constructor
  17. public ManualResetEvent (bool initialState)
  18. {
  19. Handle = NativeEventCalls.CreateEvent_internal (true, initialState, null);
  20. }
  21. // Methods
  22. public bool Set()
  23. {
  24. CheckDisposed ();
  25. return (NativeEventCalls.SetEvent_internal (Handle));
  26. }
  27. public bool Reset()
  28. {
  29. CheckDisposed ();
  30. return(NativeEventCalls.ResetEvent_internal (Handle));
  31. }
  32. }
  33. }