* make threading code dependend on feature switch

git-svn-id: trunk@23293 -
This commit is contained in:
florian 2013-01-02 10:48:29 +00:00
parent 68d04a4d21
commit 82f20cedbd
2 changed files with 9 additions and 1 deletions

View File

@ -14,14 +14,17 @@
type
IReadWriteSync = interface
{$ifdef FPC_HAS_FEATURE_THREADING}
['{7B108C52-1D8F-4CDB-9CDF-57E071193D3F}']
procedure BeginRead;
procedure EndRead;
function BeginWrite : boolean;
procedure EndWrite;
{$endif FPC_HAS_FEATURE_THREADING}
end;
TSimpleRWSync = class(TInterfacedObject,IReadWriteSync)
{$ifdef FPC_HAS_FEATURE_THREADING}
private
crit : TRtlCriticalSection;
public
@ -31,9 +34,11 @@ type
procedure Endwrite;
procedure Beginread;
procedure Endread;
{$endif FPC_HAS_FEATURE_THREADING}
end;
TMultiReadExclusiveWriteSynchronizer = class(TInterfacedObject,IReadWriteSync)
{$ifdef FPC_HAS_FEATURE_THREADING}
private
freaderqueue: peventstate;
fwritelock : TRtlCriticalSection;
@ -47,4 +52,5 @@ type
procedure Endwrite;
procedure Beginread;
procedure Endread;
{$endif FPC_HAS_FEATURE_THREADING}
end;

View File

@ -11,7 +11,7 @@
**********************************************************************}
{$ifdef FPC_HAS_FEATURE_THREADING}
constructor TSimpleRWSync.Create;
begin
System.InitCriticalSection(Crit);
@ -164,3 +164,5 @@ begin
(System.InterLockedExchangeAdd(fwritelocked,0)<>0) then
RTLEventSetEvent(fwaitingwriterlock);
end;
{$endif FPC_HAS_FEATURE_THREADING}