BeginThreadGroup
Establishes a new thread within a new thread group
#include <nwthread.h>
int BeginThreadGroup (
void (*func) (void*),
void *stack,
unsigned stackSize,
void *arg);
This function returns the new thread group’s ID if successful. It returns EFAILURE if an error occurs.
If an error occurs, errno is set to:
The BeginThreadGroup function creates a new thread group which contains one thread defined by func. Other than putting the new thread in its own thread group, this function is identical to BeginThread. A thread group can consist of one or more threads as defined by the programmer, and an NLM can have more than one thread group.
The new thread group is not the current thread group. To create more threads within the new thread group, you must make the new thread group current by calling SetThreadGroupID with the thread group ID returned by BeginThreadGroup. You can then create more threads within the new thread group by calling BeginThread for each additional thread for the new thread group.
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.
#include <nwthread.h>
#include <stdio.h>
void newThreadFunc (char *funcArg);
int completionCode;
.
.
.
completionCode = BeginThreadGroup (newThreadFunc, NULL, 8192, "/A/Q
input.fil");
.
.
.
void newThreadFunc(char *arg)
{
printf ("in new thread group\n");
}