thread.inc 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. {
  2. $Id$
  3. This file is part of the Free Pascal Run time library.
  4. Copyright (c) 2000 by the Free Pascal development team
  5. OS independent thread functions/overloads
  6. See the File COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  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. Threadvar initialization
  14. *****************************************************************************}
  15. {*****************************************************************************
  16. Overloaded functions
  17. *****************************************************************************}
  18. function BeginThread(sa : Pointer;stacksize : dword;
  19. ThreadFunction : tthreadfunc;p : pointer;creationFlags : dword;
  20. var ThreadId : Longint) : DWord;
  21. begin
  22. BeginThread:=BeginThread(nil,DefaultStackSize,ThreadFunction,p,creationFlags,Dword(THreadId));
  23. end;
  24. function BeginThread(ThreadFunction : tthreadfunc) : DWord;
  25. var
  26. dummy : dword;
  27. begin
  28. BeginThread:=BeginThread(nil,DefaultStackSize,ThreadFunction,nil,0,dummy);
  29. end;
  30. function BeginThread(ThreadFunction : tthreadfunc;p : pointer) : DWord;
  31. var
  32. dummy : dword;
  33. begin
  34. BeginThread:=BeginThread(nil,DefaultStackSize,ThreadFunction,p,0,dummy);
  35. end;
  36. function BeginThread(ThreadFunction : tthreadfunc;p : pointer;var ThreadId : DWord) : DWord;
  37. begin
  38. BeginThread:=BeginThread(nil,DefaultStackSize,ThreadFunction,p,0,ThreadId);
  39. end;
  40. function BeginThread(ThreadFunction : tthreadfunc;p : pointer;var ThreadId : Longint) : DWord;
  41. begin
  42. BeginThread:=BeginThread(nil,DefaultStackSize,ThreadFunction,p,0,Dword(ThreadId));
  43. end;
  44. procedure EndThread;
  45. begin
  46. EndThread(0);
  47. end;
  48. {
  49. $Log$
  50. Revision 1.1 2002-10-14 19:39:17 peter
  51. * threads unit added for thread support
  52. }