tthread.inc 1.9 KB

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