Changeset 305 for Common/UThreading.pas


Ignore:
Timestamp:
Jan 3, 2012, 10:31:59 AM (12 years ago)
Author:
chronos
Message:
  • Added: Property Finished of TListedThread.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Common/UThreading.pas

    r295 r305  
    1717  TVirtualThread = class
    1818  private
     19    function GetFinished: Boolean; virtual; abstract;
    1920    function GetFreeOnTerminate: Boolean; virtual; abstract;
    2021    function GetPriority: TThreadPriority; virtual; abstract;
     
    4243    property Priority: TThreadPriority read GetPriority write SetPriority;
    4344    property Terminated: Boolean read GetTerminated write SetTerminated;
     45    property Finished: Boolean read GetFinished;
    4446    property ThreadId: Integer read GetThreadId;
    4547  end;
     
    6163  private
    6264    FTerminated: Boolean;
     65    FFinished: Boolean;
    6366    FThread: TListedThreadExecute;
     67    function GetFinished: Boolean; override;
    6468    function GetFreeOnTerminate: Boolean; override;
    6569    function GetPriority: TThreadPriority; override;
     
    172176end;
    173177
    174 
    175178{ TThreadList }
    176179
     
    196199begin
    197200  try
    198     Parent.Execute;
    199   except
    200     on E: Exception do
    201       if Assigned(OnException) then
    202         OnException(Parent.FThread, E);
     201    try
     202      Parent.Execute;
     203    except
     204      on E: Exception do
     205        if Assigned(OnException) then
     206          OnException(Parent.FThread, E);
     207    end;
     208  finally
     209    Parent.FFinished := True;
    203210  end;
    204211end;
    205212
    206213{ TListedThread }
     214
     215function TListedThread.GetFinished: Boolean;
     216begin
     217  Result := FFinished;
     218end;
    207219
    208220function TListedThread.GetFreeOnTerminate: Boolean;
     
    255267  const StackSize: SizeUInt);
    256268begin
     269  FFinished := False;
     270  FTerminated := False;
     271
    257272  FThread := TListedThreadExecute.Create(True, StackSize);
    258273  FThread.Parent := Self;
Note: See TracChangeset for help on using the changeset viewer.