Ignore:
Timestamp:
Jun 19, 2024, 11:15:44 PM (5 months ago)
Author:
chronos
Message:
  • Modified: Updated Common package.
File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/Pool.pas

    r314 r315  
    1 unit UPool;
    2 
    3 {$mode Delphi}{$H+}
     1unit Pool;
    42
    53interface
    64
    75uses
    8   Classes, SysUtils, syncobjs, fgl, UThreading;
     6  Classes, SysUtils, syncobjs, Generics.Collections, Threading;
    97
    108type
     
    2220    function NewItemObject: TObject; virtual;
    2321  public
    24     Items: TFPGObjectList<TObject>;
    25     FreeItems: TFPGObjectList<TObject>;
     22    Items: TObjectList<TObject>;
     23    FreeItems: TObjectList<TObject>;
    2624    function Acquire: TObject; virtual;
    2725    procedure Release(Item: TObject); virtual;
     
    5957  try
    6058    Lock.Acquire;
    61     inherited SetTotalCount(AValue);
     59    inherited;
    6260  finally
    6361    Lock.Release;
     
    6967  try
    7068    Lock.Acquire;
    71     Result := inherited GetUsedCount;
     69    Result := inherited;
    7270  finally
    7371    Lock.Release;
     
    9088      end;
    9189    end;
    92     Result := inherited Acquire;
     90    Result := inherited;
    9391  finally
    9492    Lock.Release;
     
    10098  try
    10199    Lock.Acquire;
    102     inherited Release(Item);
     100    inherited;
    103101  finally
    104102    Lock.Release;
     
    108106constructor TThreadedPool.Create;
    109107begin
    110   inherited Create;
     108  inherited;
    111109  Lock := TCriticalSection.Create;
    112110end;
     
    115113begin
    116114  TotalCount := 0;
    117   Lock.Free;
    118   inherited Destroy;
     115  FreeAndNil(Lock);
     116  inherited;
    119117end;
    120118
     
    185183begin
    186184  inherited;
    187   Items := TFPGObjectList<TObject>.Create;
    188   FreeItems := TFPGObjectList<TObject>.Create;
    189   FreeItems.FreeObjects := False;
     185  Items := TObjectList<TObject>.Create;
     186  FreeItems := TObjectList<TObject>.Create;
     187  FreeItems.OwnsObjects := False;
    190188  FReleaseEvent := TEvent.Create(nil, False, False, '');
    191189end;
     
    201199
    202200end.
    203 
Note: See TracChangeset for help on using the changeset viewer.