|
@@ -127,6 +127,12 @@ Function Sptr : pointer;assembler;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
+{$ifndef VER3_2}
|
|
|
|
+{$define FPC_SYSTEM_INTERLOCKED_USE_INTRIN}
|
|
|
|
+{$endif VER3_2}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+{$ifdef VER3_2}
|
|
function InterLockedDecrement (var Target: longint) : longint;
|
|
function InterLockedDecrement (var Target: longint) : longint;
|
|
begin
|
|
begin
|
|
Result:=Target-1;
|
|
Result:=Target-1;
|
|
@@ -148,14 +154,6 @@ function InterLockedExchange (var Target: longint;Source : longint) : longint;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
-function InterlockedCompareExchange(var Target: longint; NewValue: longint; Comperand: longint): longint;
|
|
|
|
- begin
|
|
|
|
- Result:=Target;
|
|
|
|
- if Result=Comperand then
|
|
|
|
- Target:=NewValue;
|
|
|
|
- end;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
function InterLockedExchangeAdd (var Target: longint;Source : longint) : longint;
|
|
function InterLockedExchangeAdd (var Target: longint;Source : longint) : longint;
|
|
begin
|
|
begin
|
|
Result:=Target;
|
|
Result:=Target;
|
|
@@ -184,18 +182,37 @@ function InterLockedExchange (var Target: smallint;Source : smallint) : smallint
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
-function InterlockedCompareExchange(var Target: smallint; NewValue: smallint; Comperand: smallint): smallint;
|
|
|
|
|
|
+function InterLockedExchangeAdd (var Target: smallint;Source : smallint) : smallint;
|
|
begin
|
|
begin
|
|
Result:=Target;
|
|
Result:=Target;
|
|
- if Result=Comperand then
|
|
|
|
|
|
+ Target:=Result+Source;
|
|
|
|
+ end;
|
|
|
|
+{$endif VER3_2}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+{$ifdef VER3_2}
|
|
|
|
+function InterlockedCompareExchange(var Target: longint; NewValue: longint; Comperand: longint): longint;
|
|
|
|
+{$else VER3_2}
|
|
|
|
+{$define FPC_SYSTEM_HAS_ATOMIC_CMP_XCHG_32}
|
|
|
|
+function fpc_atomic_cmp_xchg_32 (var Target: longint; NewValue : longint; Comparand: longint): longint; [public,alias:'FPC_ATOMIC_CMP_XCHG_32'];
|
|
|
|
+{$endif VER3_2}
|
|
|
|
+ begin
|
|
|
|
+ Result:=Target;
|
|
|
|
+ if Result={$ifdef VER3_2}Comperand{$else}Comparand{$endif} then
|
|
Target:=NewValue;
|
|
Target:=NewValue;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
-function InterLockedExchangeAdd (var Target: smallint;Source : smallint) : smallint;
|
|
|
|
|
|
+{$ifdef VER3_2}
|
|
|
|
+function InterlockedCompareExchange(var Target: smallint; NewValue: smallint; Comperand: smallint): smallint;
|
|
|
|
+{$else VER3_2}
|
|
|
|
+{$define FPC_SYSTEM_HAS_ATOMIC_CMP_XCHG_16}
|
|
|
|
+function fpc_atomic_cmp_xchg_16 (var Target: smallint; NewValue : smallint; Comparand: smallint): smallint;
|
|
|
|
+{$endif VER3_2}
|
|
begin
|
|
begin
|
|
Result:=Target;
|
|
Result:=Target;
|
|
- Target:=Result+Source;
|
|
|
|
|
|
+ if Result={$ifdef VER3_2}Comperand{$else}Comparand{$endif} then
|
|
|
|
+ Target:=NewValue;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|