threadh.inc 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. This File contains the OS indenpendend declartions for multi
  6. threading support in FPC
  7. See the File COPYING.FPC, included in this distribution,
  8. for details about the copyright.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. **********************************************************************}
  13. const
  14. DefaultStackSize = 32768; { including 16384 margin for stackchecking }
  15. type
  16. TThreadFunc = function(parameter : pointer) : longint;
  17. {*****************************************************************************
  18. Multithread Handling
  19. *****************************************************************************}
  20. function BeginThread(sa : Pointer;stacksize : dword;
  21. ThreadFunction : tthreadfunc;p : pointer;creationFlags : dword;
  22. var ThreadId : DWord) : DWord;
  23. { Delphi uses a longint for threadid }
  24. function BeginThread(sa : Pointer;stacksize : dword;
  25. ThreadFunction : tthreadfunc;p : pointer;creationFlags : dword;
  26. var ThreadId : Longint) : DWord;
  27. { add some simplfied forms which make lifer easier and porting }
  28. { to other OSes too ... }
  29. function BeginThread(ThreadFunction : tthreadfunc) : DWord;
  30. function BeginThread(ThreadFunction : tthreadfunc;p : pointer) : DWord;
  31. function BeginThread(ThreadFunction : tthreadfunc;p : pointer; var ThreadId : DWord) : DWord;
  32. function BeginThread(ThreadFunction : tthreadfunc;p : pointer; var ThreadId : Longint) : DWord;
  33. procedure EndThread(ExitCode : DWord);
  34. procedure EndThread;
  35. { this allows to do a lot of things in MT safe way }
  36. { it is also used to make the heap management }
  37. { thread safe }
  38. procedure InitCriticalSection(var cs : TRTLCriticalSection);
  39. procedure DoneCriticalsection(var cs : TRTLCriticalSection);
  40. procedure EnterCriticalsection(var cs : TRTLCriticalSection);
  41. procedure LeaveCriticalsection(var cs : TRTLCriticalSection);
  42. {
  43. $Log$
  44. Revision 1.9 2002-10-16 19:04:27 michael
  45. + More system-independent thread routines
  46. Revision 1.8 2002/10/14 19:39:17 peter
  47. * threads unit added for thread support
  48. Revision 1.7 2002/09/07 15:07:46 peter
  49. * old logs removed and tabs fixed
  50. Revision 1.6 2002/07/28 20:43:48 florian
  51. * several fixes for linux/powerpc
  52. * several fixes to MT
  53. }