[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'System' (#rtl)

BeginThread

Start a new thread.

Declaration

Source position: threadh.inc line 124

function BeginThread(

  sa: Pointer;

  stacksize: SizeUInt;

  ThreadFunction: TThreadFunc;

  p: pointer;

  creationFlags: DWord;

  var ThreadId: TThreadID

):TThreadID;

function BeginThread(

  ThreadFunction: TThreadFunc

):TThreadID;

function BeginThread(

  ThreadFunction: TThreadFunc;

  p: pointer

):TThreadID;

function BeginThread(

  ThreadFunction: TThreadFunc;

  p: pointer;

  var ThreadId: TThreadID

):TThreadID;

function BeginThread(

  ThreadFunction: TThreadFunc;

  p: pointer;

  var ThreadId: TThreadID;

  const stacksize: SizeUInt

):TThreadID;

Description

BeginThread starts a new thread and executes ThreadFunction in the new thread. If P is specified, then it is passed to ThreadFunction. If ThreadId is specified, it is filled with the thread ID of the newly started thread. If StackSize is specified, it is set as the stack size for the new thread. If none is specified, a default stack size of 4MiB is used.

The function returns the thread handle (or ID, on some other operating systems like Linux or OS/2) on success, or 0 if an error occurred. Note that the thread ID and handle are the same on Unix processes, and that the thread ID and thread handle are different on windows systems.

Errors

On error, the value "0" is returned.

See also

EndThread

  

End the current thread.


Documentation generated on: Jun 22 2020