AutoResetEvent.cs 656 B

1234567891011121314151617181920212223242526272829303132333435
  1. //
  2. // System.Threading.AutoResetEvent.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 AutoResetEvent : WaitHandle
  15. {
  16. // Constructor
  17. public AutoResetEvent(bool initialState) {
  18. Handle = NativeEventCalls.CreateEvent_internal(false,initialState,null);
  19. }
  20. // Methods
  21. public bool Set() {
  22. return(NativeEventCalls.SetEvent_internal(Handle));
  23. }
  24. public bool Reset() {
  25. return(NativeEventCalls.ResetEvent_internal(Handle));
  26. }
  27. }
  28. }