Unmap memory, close handle, exit.
#include <zircon/syscalls.h> zx_status_t zx_vmar_unmap_handle_close_thread_exit(zx_handle_t vmar_handle, zx_vaddr_t addr, size_t size, zx_handle_t close_handle);
zx_vmar_unmap_handle_close_thread_exit() does a sequence of three operations:
zx_vmar_unmap(vmar_handle, addr, size)
The expectation is that the first operation unmaps a region including the
calling thread's own stack. (It's not required, but it's permitted.) This
is valid for this call, though it would be invalid for
any other call.
zx_vmar_unmap() operation is successful, then this call never returns.
If close_handle is an invalid handle so that the
fails, then the thread takes a trap (as if by
zx_vmar_unmap_handle_close_thread_exit() does not return on success.
The intended use for this is for a dying thread to unmap its own stack, close its own thread handle, and exit. The thread handle cannot be closed beforehand because closing the last handle to a thread kills that thread. The stack cannot be unmapped beforehand because the thread must have some stack space on which to make its final system calls.
This call is used for detached threads, while
is used for joinable threads.
Except 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 2019-11-21.