home *** CD-ROM | disk | FTP | other *** search
- { *************************************************************************** }
- { }
- { Kylix and Delphi Cross-Platform Visual Component Library }
- { }
- { Copyright (c) 1997, 2001 Borland Software Corporation }
- { }
- { *************************************************************************** }
-
-
- unit SyncObjs;
-
- {$H+,X+}
-
- interface
-
- uses
- {$IFDEF MSWINDOWS}
- Windows,
- Messages,
- {$ENDIF}
- {$IFDEF LINUX}
- Libc,
- {$ENDIF}
- SysUtils,
- Classes;
-
- type
- {$IFNDEF MSWINDOWS}
- PSecurityAttributes = pointer;
- {$ENDIF}
-
- TSynchroObject = class(TObject)
- public
- procedure Acquire; virtual;
- procedure Release; virtual;
- end;
-
- THandleObject = class(TSynchroObject)
- {$IFDEF MSWINDOWS}
- public
- destructor Destroy; override;
- property LastError: Integer;
- property Handle: THandle;
- {$ENDIF}
- end;
-
- TWaitResult = (wrSignaled, wrTimeout, wrAbandoned, wrError);
-
- TEvent = class(THandleObject)
- {$IFDEF LINUX}
- public
- constructor Create(EventAttributes: PSecurityAttributes; ManualReset,
- InitialState: Boolean; const Name: string);
- function WaitFor(Timeout: LongWord): TWaitResult;
- procedure SetEvent;
- procedure ResetEvent;
- end;
-
- TSimpleEvent = class(TEvent)
- public
- constructor Create;
- end;
-
- TCriticalSection = class(TSynchroObject)
- protected
- FSection: TRTLCriticalSection;
- public
- constructor Create;
- destructor Destroy; override;
- procedure Acquire; override;
- procedure Release; override;
- procedure Enter;
- procedure Leave;
- end;
-
- implementation
-