BeginThread
Initiates a new thread of execution within the current thread group
#include <nwthread.h>
int BeginThread (
void (*func) (void *),
void *stack,
unsigned stackSize,
void *arg);
This function returns the new thread’s ID if successful. It returns EFAILURE if an error occurs.
If an error occurs, errno is set to:
The new thread begins execution at the specified function ( func). The function func receives arg as a parameter. The stack parameter is a pointer to a block of memory that the new thread uses as its stack.
The arg parameter is any 32-bit quantity, although typically some sort of pointer is passed, or NULL is passed if the specified function does not take any arguments.
If the newly created thread returns from the function func, it is be equivalent to its having executed the ExitThread function with an action code of EXIT_THREAD.
To begin a thread in a new thread group, call BeginThreadGroup.
#include <nwthread.h>
void newThreadFunc (char *funcArg);
int completionCode;
.
.
.
completionCode = BeginThread (newThreadFunc, NULL, 8192, /A/Q
"input.fil");
.
.
.
void newThreadFunc (char *arg)
{
printf ("in new thread\n");
}