Skip to content

Latest commit

 

History

History
53 lines (35 loc) · 1.49 KB

thread_start.md

File metadata and controls

53 lines (35 loc) · 1.49 KB

zx_thread_start

NAME

thread_start - start execution on a thread

SYNOPSIS

#include <zircon/syscalls.h>

zx_status_t zx_thread_start(zx_handle_t thread, uintptr_t entry, uintptr_t stack,
                            uintptr_t arg1, uintptr_t arg2);

DESCRIPTION

thread_start() causes a thread to begin execution at the program counter specified by entry and with the stack pointer set to stack. The arguments arg1 and arg2 are arranged to be in the architecture specific registers used for the first two arguments of a function call before the thread is started. All other registers are zero upon start.

When the last handle to a thread is closed, the thread is destroyed.

Thread handles may be waited on and will assert the signal ZX_THREAD_TERMINATED when the thread stops executing (due to thread_exit*() being called.

RETURN VALUE

thread_start() returns ZX_OK on success. In the event of failure, a negative error value is returned.

ERRORS

ZX_ERR_BAD_HANDLE thread is not a valid handle.

ZX_ERR_WRONG_TYPE thread is not a thread handle.

ZX_ERR_ACCESS_DENIED The handle thread lacks ZX_RIGHT_WRITE.

ZX_ERR_BAD_STATE thread is not ready to run or the process thread is part of is no longer alive.

SEE ALSO

handle_close, handle_duplicate, object_wait_one, object_wait_many, thread_create, thread_exit.