thread - runnable / computation entity
SYNOPSISTODO
DESCRIPTIONThe thread object is the construct that represents a time-shared CPU execution context. Thread objects live associated to a particular Process Object, which provides the memory and the handles to other objects necessary for I/O and computation.
LifetimeThreads are created by calling zx_thread_create()
, but only start executing when either zx_thread_start()
or zx_process_start()
are called. Both syscalls take as an argument the entrypoint of the initial routine to execute.
The thread passed to zx_process_start()
should be the first thread to start execution on a process.
A thread terminates execution: + by calling zx_thread_exit()
+ by calling zx_vmar_unmap_handle_close_thread_exit()
+ by calling zx_futex_wake_handle_close_thread_exit()
+ when the parent process terminates + by calling zx_task_kill()
with the thread's handle + after generating an exception for which there is no handler or the handler decides to terminate the thread.
Returning from the entrypoint routine does not terminate execution. The last action of the entrypoint should be to call zx_thread_exit()
or one of the above mentioned _exit()
variants.
Closing the last handle to a thread does not terminate execution. In order to forcefully kill a thread for which there is no available handle, use zx_object_get_child()
to obtain a handle to the thread. This method is strongly discouraged. Killing a thread that is executing might leave the process in a corrupt state.
Fuchsia native threads are always detached. That is, there is no join() operation needed to do a clean termination. However, some runtimes above the kernel, such as C11 or POSIX might require threads to be joined.
SignalsThreads provide the following signals: + ZX_THREAD_TERMINATED
+ ZX_THREAD_SUSPENDED
+ ZX_THREAD_RUNNING
When a thread is started ZX_THREAD_RUNNING
is asserted. When it is suspended ZX_THREAD_RUNNING
is deasserted, and ZX_THREAD_SUSPENDED
is asserted. When the thread is resumed ZX_THREAD_SUSPENDED
is deasserted and ZX_THREAD_RUNNING
is asserted. When a thread terminates both ZX_THREAD_RUNNING
and ZX_THREAD_SUSPENDED
are deasserted and ZX_THREAD_TERMINATED
is asserted.
Note that signals are OR'd into the state maintained by the zx_object_wait_*()
family of functions thus you may see any combination of requested signals when they return.
zx_thread_create()
- create a new thread within a processzx_thread_exit()
- exit the current threadzx_thread_read_state()
- read register state from a threadzx_thread_start()
- cause a new thread to start executingzx_thread_write_state()
- modify register state of a threadzx_task_create_exception_channel()
- listen for task exceptionszx_task_kill()
- cause a task to stop runningExcept as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-02-28 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-28 UTC."],[],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4