home *** CD-ROM | disk | FTP | other *** search
/ Kompuutteri K-CD 2002 #1 / K-CD_2002-01.iso / Delphi / INSTALL / program files / Borland / Delphi6 / Doc / SyncObjs.int < prev    next >
Encoding:
Text File  |  2001-05-22  |  1.8 KB  |  77 lines

  1. { *************************************************************************** }
  2. {                                                                             }
  3. { Kylix and Delphi Cross-Platform Visual Component Library                    }
  4. {                                                                             }
  5. { Copyright (c) 1997, 2001 Borland Software Corporation                       }
  6. {                                                                             }
  7. { *************************************************************************** }
  8.  
  9.  
  10. unit SyncObjs;
  11.  
  12. {$H+,X+}
  13.  
  14. interface
  15.  
  16. uses 
  17. {$IFDEF MSWINDOWS}
  18.   Windows, 
  19.   Messages,
  20. {$ENDIF}
  21. {$IFDEF LINUX}
  22.   Libc,
  23. {$ENDIF}
  24.   SysUtils, 
  25.   Classes;
  26.  
  27. type
  28. {$IFNDEF MSWINDOWS}
  29.   PSecurityAttributes = pointer;
  30. {$ENDIF}
  31.  
  32.   TSynchroObject = class(TObject)
  33.   public
  34.     procedure Acquire; virtual;
  35.     procedure Release; virtual;
  36.   end;
  37.  
  38.   THandleObject = class(TSynchroObject)
  39. {$IFDEF MSWINDOWS}
  40.   public
  41.     destructor Destroy; override;
  42.     property LastError: Integer;
  43.     property Handle: THandle;
  44. {$ENDIF}
  45.   end;
  46.  
  47.   TWaitResult = (wrSignaled, wrTimeout, wrAbandoned, wrError);
  48.  
  49.   TEvent = class(THandleObject)
  50.   {$IFDEF LINUX}
  51.   public
  52.     constructor Create(EventAttributes: PSecurityAttributes; ManualReset,
  53.       InitialState: Boolean; const Name: string);
  54.     function WaitFor(Timeout: LongWord): TWaitResult;
  55.     procedure SetEvent;
  56.     procedure ResetEvent;
  57.   end;
  58.  
  59.   TSimpleEvent = class(TEvent)
  60.   public
  61.     constructor Create;
  62.   end;
  63.  
  64.   TCriticalSection = class(TSynchroObject)
  65.   protected
  66.     FSection: TRTLCriticalSection;
  67.   public
  68.     constructor Create;
  69.     destructor Destroy; override;
  70.     procedure Acquire; override;
  71.     procedure Release; override;
  72.     procedure Enter;
  73.     procedure Leave;
  74.   end;
  75.  
  76. implementation
  77.