1{ 2 This file is part of the Free Component Library (FCL) 3 Copyright (c) 1999-2002 by the Free Pascal development team 4 5 See the file COPYING.FPC, included in this distribution, 6 for details about the copyright. 7 8 This program is distributed in the hope that it will be useful, 9 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 12 **********************************************************************} 13 14{****************************************************************************} 15{* TThread *} 16{****************************************************************************} 17 18{$WARNING This file is only a stub, and will not work!} 19 20const 21 ThreadCount: longint = 0; 22 23(* Implementation of exported functions *) 24 25procedure AddThread (T: TThread); 26begin 27 Inc (ThreadCount); 28end; 29 30 31procedure RemoveThread (T: TThread); 32begin 33 Dec (ThreadCount); 34end; 35 36 37procedure TThread.CallOnTerminate; 38begin 39 FOnTerminate (Self); 40end; 41 42 43function TThread.GetPriority: TThreadPriority; 44begin 45 result := tpNormal; 46end; 47 48 49procedure TThread.SetPriority(Value: TThreadPriority); 50begin 51 52end; 53 54 55procedure TThread.SetSuspended(Value: Boolean); 56begin 57 if Value <> FSuspended then 58 begin 59 if Value then Suspend else Resume; 60 end; 61end; 62 63 64procedure TThread.DoTerminate; 65begin 66 if Assigned (FOnTerminate) then Synchronize (@CallOnTerminate); 67end; 68 69 70procedure TThread.SysCreate(CreateSuspended: Boolean; 71 const StackSize: SizeUInt); 72var 73 Flags: cardinal; 74begin 75 AddThread (Self); 76end; 77 78 79procedure TThread.SysDestroy; 80begin 81 if not FFinished and not Suspended then 82 begin 83 Terminate; 84 WaitFor; 85 end; 86end; 87 88procedure TThread.Resume; 89begin 90 91end; 92 93 94procedure TThread.Suspend; 95begin 96 97end; 98 99 100procedure TThread.Terminate; 101begin 102 FTerminated := true; 103 TerminatedSet; 104end; 105 106 107function TThread.WaitFor: Integer; 108begin 109 result := -1; 110end; 111 112 113