Beginthread

Beginthread

In the C programming language, the beginthread function is declared in process.h header file.

This function creates a new thread of execution within the current process.

Prototype

:unsigned long _beginthread(void(* Func)(void*), unsigned Stack_size, void *Arg);

Func

Thread execution starts at the beginning of the function func. To terminate the thread correctly, func must call _endthread, freeing memory allocated by the run time library to support the thread.

tack_size

The operating system allocates a stack for the thread containing the number of bytes specified by stack_size. If the value of stack_size is zero, the operating system creates a stack the same size as that of the main thread. [http://msdn2.microsoft.com/en-gb/library/kdzttdcb(VS.80).aspx MSDN _beginthread] ]

Arg

The operating system passes Arg to Func when execution begins. Arg can be any 32-bit value cast to void*.

Return value

Returns the operating system handle of the newly created thread. If unsuccessful, the function returns -1 and sets errno.

Compiler switches

To compile a program using multiple threads with the Microsoft C/C++ Compiler, you must specify the /MT switch (or /MTd, for debug programs).

References


Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать курсовую

Look at other dictionaries:

  • Fork bomb — The concept behind the fork bomb – the processes recursively fork until a denial of service or a crash occurs In computing, the fork bomb is a form of denial of service attack against a computer system which makes use of the fork operation (or… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”