# NewThread

Creates a new thread.

### Synopsis

`Item NewThread (void* threadProcPtr, int32 stackSize, int32 threadPriority, char* threadName, void** stackMemoryPtr, int32 argc, void* argp)`

### Description

Creates a new thread with the specified attributes. `NewThread()` translates the thread attributes into corresponding tag arguments and calls `CreateItem()` directly, specifying those tag arguments.

`NewDataStream()` and `NewDataAcq()` call `NewThread()` to create new stream and acquisition threads, respectively.

### Arguments

`threadProcPtr`
  Pointer assigned to the new thread.

`stackSize`
  Size of the stack space allocated to the new thread. Rounded off to the nearest data word (4-byte value).

`threadPriority`
  Priority value assigned to the new thread.

`threadName`
  Name (character string) assigned to the new thread. If `NULL`, `NewThread()` assigns a thread name with the string "Thread" prefixed to the address of the stack memory allocated to the thread.

`stackMemoryPtr`
  Pointer assigned to the stack memory allocated for the thread.

`argc`
  Number of arguments in the new thread.

`argp`
  Pointer to the arguments in the new thread.

### Return Value

Value
  Error Condition

(The item of the new thread)
  None

0
  Could not allocate stack memory for thread

(Portfolio error code)
  `CreateItem()` failed

See "Error Messages" in the 3DO Portfolio Reference Manual for a listing of error messages returned by`CreateItem()`.

### Associated Files

ThreadHelper.h

### See Also

`CreateItem, CreateThread DisposeTextSubscriber`