syncobh.inc 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. {
  2. This file is part of the Free Component Library (FCL)
  3. Copyright (c) 1999-2000 by Florian Klaempfl
  4. member of the Free Pascal development team
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. type
  12. TWaitResult = (wrSignaled, wrTimeout, wrAbandoned, wrError);
  13. TSynchroObject = class(TObject)
  14. procedure Acquire;virtual;
  15. procedure Release;virtual;
  16. end;
  17. TCriticalSection = class(TSynchroObject)
  18. private
  19. CriticalSection : TRTLCriticalSection;
  20. public
  21. procedure Acquire;override;
  22. procedure Release;override;
  23. procedure Enter;
  24. procedure Leave;
  25. constructor Create;
  26. destructor Destroy;override;
  27. end;
  28. THandleObject = class(TSynchroObject)
  29. protected
  30. FHandle : TEventHandle;
  31. FLastError : Integer;
  32. public
  33. destructor destroy;override;
  34. property Handle : TEventHandle read FHandle;
  35. property LastError : Integer read FLastError;
  36. end;
  37. TEventObject = class(THandleObject)
  38. private
  39. FSem: Pointer;
  40. FManualReset: Boolean;
  41. FEventSection: TCriticalSection;
  42. public
  43. constructor Create(EventAttributes : PSecurityAttributes;
  44. AManualReset,InitialState : Boolean;const Name : string);
  45. destructor destroy; override;
  46. procedure ResetEvent;
  47. procedure SetEvent;
  48. function WaitFor(Timeout : Cardinal) : TWaitResult;
  49. Property ManualReset : Boolean read FManualReset;
  50. end;
  51. TEvent = TEventObject;
  52. TSimpleEvent = class(TEventObject)
  53. constructor Create;
  54. end;