spawn

Create a new thread and execute a new program within it using a program name.

int spawn (int mode, char * program[, arguments]...);

Required Header
<process.h>

Return Value

If the mode is WAIT then the return value is the return code from the new program. The NOWAIT option returns a handle to the new thread. -1 indicates an error.

Parameters

mode

  The wait mode

program

  The program to execute

arguments

  The NULL terminated argument list to pass

Remarks

The spawn function starts a new thread using the _beginthread function and optionally waits for its termination using the _syncthread function.

The new thread executes program using an R1 pointer to a parameter list built from arguments. The value before the NULL terminator has its high-bit set when passed to program.

The value of mode can be one of: WAIT or NOWAIT.

Process and Threads

See Also    _beginthread, _endthread, spawnc, _syncthread, system