[ Previous | Next | Contents | Home | Search ]
AIX Version 4.3 Kernel and Subsystems Technical Reference, Volume 1

thread_create Kernel Service


Creates a new kernel thread in the calling process.


#include <sys/thread.h>
tid_t thread_create ()


The thread_create kernel service creates a new kernel-only thread in the calling process. The thread's ID is returned; it is unique system wide.

The new thread does not begin running immediately; its state is set to TSIDL. The execution will start after a call to the kthread_start kernel service. If the process is exited prior to the thread being made runnable, the thread's resources are released immediately. The thread's signal mask is inherited from the calling thread; the set of pending signals is cleared. Signals sent to the thread are marked pending while the thread is in the TSIDL state.

If the calling thread is bound to a specific processor, the new thread will also be bound to the processor.

Execution Environment

The thread_create kernel service can be called from the process environment only.

Return Values

Upon successful completion, the new thread's ID is returned. Otherwise, -1 is returned, and the error code can be checked by calling the getuerror kernel service.

Error Codes

EAGAIN The total number of kernel threads executing system wide or the maximum number of kernel threads per process would be exceeded.
ENOMEM There is not sufficient memory to create the kernel thread.

Implementation Specifics

The thread_create kernel service is part of the Base Operating System (BOS) Runtime.

Related Information

The kthread_start kernel service.

Process and Exception Management Kernel Services in AIX Kernel Extensions and Device Support Programming Concepts.

[ Previous | Next | Contents | Home | Search ]