Zircon Thread Thread

definition

thread - runnable / computing entity

description

Thread execution context object is a structural representation of the shared CPU time. Particular thread associated with the object exists in the process object , there is provided I / O and memory and calculations required to handle other objects.

Survival

Thread by calling [ zx_thread_create()] created, but only after calling [ zx_thread_start()] or [ zx_process_start()when] started. These two system calls a routine to be performed the initial entry point as a parameter.

Passed to the zx_process_start()thread] should start a thread in the process of execution.

Thread terminate 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 is terminated
  • By handle parameter with the calling thread [ zx_task_kill()]
  • After the exception handler or the handler does not respond to the decision to terminate the thread.

From the entry point function returns, the thread does not terminate execution. Finally, the operation should be the entry point function call [ zx_thread_exit()] or the above-mentioned _exit()variants.

Close the thread handle does not terminate the last thread. To force to kill thread handle is not available, use [ zx_object_get_child()] to obtain a thread handle. It is strongly recommended not to use this method. Might kill thread execution in the process of being corrupt state.

Fuchsia native threads are always separated . In other words, do not need to * join () * operation to complete a clean termination. However, on a number of run-time kernel runtimes, such as C11 or POSIX threads you may need to be connected.

System calls

  • [ zx_thread_create()] - create a new thread in the process
  • [ zx_thread_exit()] - exit the current thread
  • [ zx_thread_read_state()] - read the registration status from thread
  • [ zx_thread_start()] - the new thread begins execution
  • [ zx_thread_write_state()] - registered modify the state of the thread

  • [ zx_task_bind_exception_port()] - the exception port attached to the task
  • [ zx_task_kill()] - the task to stop running

Guess you like

Origin blog.csdn.net/sinat_20184565/article/details/93907162