Changeset 315 for trunk/Packages/Common/Pool.pas
- Timestamp:
- Jun 19, 2024, 11:15:44 PM (5 months ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/Pool.pas
r314 r315 1 unit UPool; 2 3 {$mode Delphi}{$H+} 1 unit Pool; 4 2 5 3 interface 6 4 7 5 uses 8 Classes, SysUtils, syncobjs, fgl, UThreading;6 Classes, SysUtils, syncobjs, Generics.Collections, Threading; 9 7 10 8 type … … 22 20 function NewItemObject: TObject; virtual; 23 21 public 24 Items: T FPGObjectList<TObject>;25 FreeItems: T FPGObjectList<TObject>;22 Items: TObjectList<TObject>; 23 FreeItems: TObjectList<TObject>; 26 24 function Acquire: TObject; virtual; 27 25 procedure Release(Item: TObject); virtual; … … 59 57 try 60 58 Lock.Acquire; 61 inherited SetTotalCount(AValue);59 inherited; 62 60 finally 63 61 Lock.Release; … … 69 67 try 70 68 Lock.Acquire; 71 Result := inherited GetUsedCount;69 Result := inherited; 72 70 finally 73 71 Lock.Release; … … 90 88 end; 91 89 end; 92 Result := inherited Acquire;90 Result := inherited; 93 91 finally 94 92 Lock.Release; … … 100 98 try 101 99 Lock.Acquire; 102 inherited Release(Item);100 inherited; 103 101 finally 104 102 Lock.Release; … … 108 106 constructor TThreadedPool.Create; 109 107 begin 110 inherited Create;108 inherited; 111 109 Lock := TCriticalSection.Create; 112 110 end; … … 115 113 begin 116 114 TotalCount := 0; 117 Lock.Free;118 inherited Destroy;115 FreeAndNil(Lock); 116 inherited; 119 117 end; 120 118 … … 185 183 begin 186 184 inherited; 187 Items := T FPGObjectList<TObject>.Create;188 FreeItems := T FPGObjectList<TObject>.Create;189 FreeItems. FreeObjects := False;185 Items := TObjectList<TObject>.Create; 186 FreeItems := TObjectList<TObject>.Create; 187 FreeItems.OwnsObjects := False; 190 188 FReleaseEvent := TEvent.Create(nil, False, False, ''); 191 189 end; … … 201 199 202 200 end. 203
Note:
See TracChangeset
for help on using the changeset viewer.