syncobh.inc 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. {
  2. $Id$
  3. This file is part of the Free Component Library (FCL)
  4. Copyright (c) 1999-2000 by Florian Klaempfl
  5. member of the Free Pascal development team
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. type
  13. TWaitResult = (wrSignaled, wrTimeout, wrAbandoned, wrError);
  14. TSyncroObject = class(TObject)
  15. procedure Acquire;virtual;abstract;
  16. procedure Release;virtual;abstract;
  17. end;
  18. TCriticalSection = class(TSyncroObject)
  19. private
  20. CriticalSection : TRTLCriticalSection;
  21. public
  22. procedure Acquire;override;
  23. procedure Release;override;
  24. procedure Enter;
  25. procedure Leave;
  26. constructor Create;
  27. destructor Destroy;override;
  28. end;
  29. THandleObject = class(TSyncroObject)
  30. protected
  31. FHandle : TEventHandle;
  32. FLastError : Integer;
  33. public
  34. destructor destroy;override;
  35. property Handle : TEventHandle read FHandle;
  36. property LastError : Integer read FLastError;
  37. end;
  38. TEventObject = class(THandleObject)
  39. private
  40. FSem: Pointer;
  41. FManualReset: Boolean;
  42. FEventSection: TCriticalSection;
  43. public
  44. constructor Create(EventAttributes : PSecurityAttributes;
  45. AManualReset,InitialState : Boolean;const Name : string);
  46. destructor destroy; override;
  47. procedure ResetEvent;
  48. procedure SetEvent;
  49. function WaitFor(Timeout : Cardinal) : TWaitResult;
  50. Property ManualReset : Boolean read FManualReset;
  51. end;
  52. TEvent = TEventObject;
  53. TSimpleEvent = class(TEventObject)
  54. constructor Create;
  55. end;
  56. {
  57. $Log$
  58. Revision 1.6 2003-06-14 19:14:58 michael
  59. + Some improvements for the Linux version
  60. Revision 1.5 2003/06/11 12:00:09 michael
  61. + Implemented Win32 of syncobjs
  62. Revision 1.4 2002/09/07 15:15:26 peter
  63. * old logs removed and tabs fixed
  64. }