Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>_beginthread() create a thread (os/2)</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _beginthread()          Create a Thread (OS/2)

 #include    <process.h>
 #include    <stddef.h>

 int _beginthread(threadfunc, stackaddress, stacksize, arglist)
 void (_far *threadfunc)( void _far * );   Address of thread function
 void _far *stackaddress;                  Address of thread stack
 unsigned stacksize;                       Size of stack
 void _far *arglist;                       Address of argument list to pass

    This OS/2 function creates a thread which starts executing a far
    routine at stackaddress. If stackaddress is NULL, the run-time
    library routine allocates and deallocates the thread stack as
    necessary. If you wish, you can stop the thread with _endthread().
    To use these functions, you must link to the LLIBCMT.LIB,
    LLIBCDLL.LIB, or CDLLOBJS.LIB library (i.e. use the /MT option).

    If stackaddress is not NULL, it must specify a word address,
    usually part of a global array or memory allocated with malloc();
    you should have about 2K of free stack space when calling any API
    routine.

    arglist is a parameter whose size is that of a far pointer, which
    is passed to the new thread. Usually, it is the address of some data
    (like a character string) that you want to pass to the new thread. If
    you do not plan to use it, set the arglist paramter to NULL.

    stacksize is the size of the stack, and threadfunc is a far
    pointer to the thread function that is to be started.

    Returns:    The thread's identification number, -1 for failure;
                errno is set to either EINVAL or EAGAIN.

    Notes:      The OS/2 function DosCreateThread() should not be called
                directly to create threads; use _beginthread() instead.

 Portability:   Only works under OS/2, not supported by ANSI.

See Also: _endthread()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson