mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 14:29:14 +02:00
Added TThreadlist code. Shane
This commit is contained in:
parent
8d2b35c5ef
commit
ff7424265d
@ -344,28 +344,48 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
constructor TThreadList.Create;
|
constructor TThreadList.Create;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
inherited Create;
|
||||||
|
//InitializeCriticalSection(FLock);
|
||||||
|
FList := TList.Create;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
destructor TThreadList.Destroy;
|
destructor TThreadList.Destroy;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
LockList;
|
||||||
|
try
|
||||||
|
FList.Free;
|
||||||
|
inherited Destroy;
|
||||||
|
finally
|
||||||
|
UnlockList;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
procedure TThreadList.Add(Item: Pointer);
|
procedure TThreadList.Add(Item: Pointer);
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
Locklist;
|
||||||
|
try
|
||||||
|
//make sure it's not already in the list
|
||||||
|
if FList.indexof(Item) = -1 then
|
||||||
|
FList.Add(Item);
|
||||||
|
finally
|
||||||
|
UnlockList;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TThreadList.Clear;
|
procedure TThreadList.Clear;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
Locklist;
|
||||||
|
try
|
||||||
|
FList.Clear;
|
||||||
|
finally
|
||||||
|
UnLockList;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -374,28 +394,35 @@ function TThreadList.LockList: TList;
|
|||||||
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
LockList:=nil;
|
Result := FList;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
procedure TThreadList.Remove(Item: Pointer);
|
procedure TThreadList.Remove(Item: Pointer);
|
||||||
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
LockList;
|
||||||
|
try
|
||||||
|
FList.Remove(Item);
|
||||||
|
finally
|
||||||
|
UnlockList;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
procedure TThreadList.UnlockList;
|
procedure TThreadList.UnlockList;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.11 2000-03-20 14:30:03 pierre
|
Revision 1.12 2000-06-27 15:55:19 lazarus
|
||||||
|
Added TThreadlist code. Shane
|
||||||
|
|
||||||
|
Revision 1.11 2000/03/20 14:30:03 pierre
|
||||||
* fix of 877
|
* fix of 877
|
||||||
|
|
||||||
Revision 1.10 2000/01/07 01:24:33 peter
|
Revision 1.10 2000/01/07 01:24:33 peter
|
||||||
|
@ -34,20 +34,29 @@ implementation
|
|||||||
uses
|
uses
|
||||||
linux;
|
linux;
|
||||||
|
|
||||||
|
var
|
||||||
|
ClassList : TThreadlist;
|
||||||
|
|
||||||
{ OS - independent class implementations are in /inc directory. }
|
{ OS - independent class implementations are in /inc directory. }
|
||||||
{$i classes.inc}
|
{$i classes.inc}
|
||||||
|
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
ClassList := TThreadList.Create;
|
||||||
|
|
||||||
finalization
|
finalization
|
||||||
if ThreadsInited then
|
ClassList.Free;
|
||||||
|
|
||||||
|
if ThreadsInited then
|
||||||
DoneThreads;
|
DoneThreads;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.15 2000-01-07 01:24:34 peter
|
Revision 1.16 2000-06-27 15:55:19 lazarus
|
||||||
|
Added TThreadlist code. Shane
|
||||||
|
|
||||||
|
Revision 1.15 2000/01/07 01:24:34 peter
|
||||||
* updated copyright to 2000
|
* updated copyright to 2000
|
||||||
|
|
||||||
Revision 1.14 2000/01/07 00:01:33 peter
|
Revision 1.14 2000/01/07 00:01:33 peter
|
||||||
|
Loading…
Reference in New Issue
Block a user