[docs] Add more links to the threads object docs. TEST: Visual inspection. Change-Id: I4e30e64bb3b4a01b409dd9276d15592e4df01c9a
diff --git a/docs/objects/thread.md b/docs/objects/thread.md index 91e79c9..57dda21 100644 --- a/docs/objects/thread.md +++ b/docs/objects/thread.md
@@ -16,29 +16,29 @@ objects necessary for I/O and computation. ### Lifetime -Threads are created by calling `zx_thread_create()`, but only start executing -when either `zx_thread_start()` or `zx_process_start()` are called. Both syscalls +Threads 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 +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()` ++ 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 ++ 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 +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 +[`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. @@ -48,14 +48,25 @@ ## SYSCALLS -+ [thread_create](../syscalls/thread_create.md) - create a new thread within a process -+ [thread_exit](../syscalls/thread_exit.md) - exit the current thread -+ [thread_read_state](../syscalls/thread_read_state.md) - read register state from a thread -+ [thread_start](../syscalls/thread_start.md) - cause a new thread to start executing -+ [thread_write_state](../syscalls/thread_write_state.md) - modify register state of a thread ++ [`zx_thread_create()`] - create a new thread within a process ++ [`zx_thread_exit()`] - exit the current thread ++ [`zx_thread_read_state()`] - read register state from a thread ++ [`zx_thread_start()`] - cause a new thread to start executing ++ [`zx_thread_write_state()`] - modify register state of a thread <br> -+ [task_bind_exception_port](../syscalls/task_bind_exception_port.md) - attach an exception -port to a task -+ [task_kill](../syscalls/task_kill.md) - cause a task to stop running ++ [`zx_task_bind_exception_port()`] - attach an exception port to a task ++ [`zx_task_kill()`] - cause a task to stop running + +[`zx_futex_wake_handle_close_thread_exit()`]: ../syscalls/futex_wake_handle_close_thread_exit.md +[`zx_object_get_child()`]: ../syscalls/object_get_child.md +[`zx_process_start()`]: ../syscalls/process_start.md +[`zx_task_bind_exception_port()`]: ../syscalls/task_bind_exception_port.md +[`zx_task_kill()`]: ../syscalls/task_kill.md +[`zx_thread_create()`]: ../syscalls/thread_create.md +[`zx_thread_exit()`]: ../syscalls/thread_exit.md +[`zx_thread_read_state()`]: ../syscalls/thread_read_state.md +[`zx_thread_write_state()`]: ../syscalls/thread_write_state.md +[`zx_thread_start()`]: ../syscalls/thread_start.md +[`zx_vmar_unmap_handle_close_thread_exit()`]: ../syscalls/vmar_unmap_handle_close_thread_exit.md