mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 06:29:16 +02:00
+ initial revision
This commit is contained in:
parent
c04585305f
commit
ace5fc1f57
35
fcl/inc/syncobjs.inc
Normal file
35
fcl/inc/syncobjs.inc
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
{
|
||||||
|
$Id$
|
||||||
|
This file is part of the Free Component Library (FCL)
|
||||||
|
Copyright (c) 1998 by Florian Klaempfl
|
||||||
|
member of the Free Pascal development team
|
||||||
|
|
||||||
|
See the file COPYING.FPC, included in this distribution,
|
||||||
|
for details about the copyright.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
**********************************************************************}
|
||||||
|
|
||||||
|
procedure TCriticalSection.Enter;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Acquire;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCriticalSection.Leave;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Release;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
||||||
|
{
|
||||||
|
$Log$
|
||||||
|
Revision 1.1 1998-09-29 11:14:25 florian
|
||||||
|
+ initial revision
|
||||||
|
|
||||||
|
}
|
39
fcl/inc/syncobjsh.inc
Normal file
39
fcl/inc/syncobjsh.inc
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
$Id$
|
||||||
|
This file is part of the Free Component Library (FCL)
|
||||||
|
Copyright (c) 1998 by Florian Klaempfl
|
||||||
|
member of the Free Pascal development team
|
||||||
|
|
||||||
|
See the file COPYING.FPC, included in this distribution,
|
||||||
|
for details about the copyright.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
**********************************************************************}
|
||||||
|
|
||||||
|
type
|
||||||
|
TSyncroObject = class(TObject)
|
||||||
|
procedure Acquire;virtual;abstract;
|
||||||
|
procedure Release;virtual;abstract;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TCriticalSection = class(TSyncroObject)
|
||||||
|
private
|
||||||
|
CriticalSection : TRTLCriticalSection;
|
||||||
|
public
|
||||||
|
procedure Acquire;override;
|
||||||
|
procedure Release;override;
|
||||||
|
procedure Enter;
|
||||||
|
procedure Leave;
|
||||||
|
constructor Create;
|
||||||
|
destructor Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{
|
||||||
|
$Log$
|
||||||
|
Revision 1.1 1998-09-29 11:14:25 florian
|
||||||
|
+ initial revision
|
||||||
|
|
||||||
|
}
|
65
fcl/win32/syncobjs.pp
Normal file
65
fcl/win32/syncobjs.pp
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
{
|
||||||
|
$Id$
|
||||||
|
This file is part of the Free Component Library (FCL)
|
||||||
|
Copyright (c) 1998 by Florian Klaempfl
|
||||||
|
member of the Free Pascal development team
|
||||||
|
|
||||||
|
See the file COPYING.FPC, included in this distribution,
|
||||||
|
for details about the copyright.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
**********************************************************************}
|
||||||
|
|
||||||
|
unit syncobjs;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
sysutils;
|
||||||
|
|
||||||
|
{$syncobjsh.inc}
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
windows;
|
||||||
|
|
||||||
|
{$syncobjs.inc}
|
||||||
|
|
||||||
|
procedure TCriticalSection.Acquire;
|
||||||
|
|
||||||
|
begin
|
||||||
|
EnterCriticalSection(CriticalSection);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCriticalSection.Release;
|
||||||
|
|
||||||
|
begin
|
||||||
|
LeaveCriticalSection(CriticalSection);
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TCriticalSection.Create;
|
||||||
|
|
||||||
|
begin
|
||||||
|
inherited Create;
|
||||||
|
InitializeCriticalSection(CriticalSection);
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TCriticalSection.Destroy;
|
||||||
|
|
||||||
|
begin
|
||||||
|
DeleteCriticalSection(CriticalSection);
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
||||||
|
{
|
||||||
|
$Log$
|
||||||
|
Revision 1.1 1998-09-29 11:15:24 florian
|
||||||
|
+ initial revision
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user