blob: 69ea186089de5ac33887f663454439c8a2eaf1d2 [file] [log] [blame]
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library zx;
@transport("Syscall")
protocol thread {
/// Terminate the current running thread.
@noreturn
thread_exit();
/// Create a thread.
/// Rights: process must be of type ZX_OBJ_TYPE_PROCESS and have ZX_RIGHT_MANAGE_THREAD.
thread_create(resource struct {
process handle:PROCESS;
name string;
options uint32;
}) -> (resource struct {
status status;
out handle:THREAD;
});
/// Start execution on a thread.
/// Rights: handle must be of type ZX_OBJ_TYPE_THREAD and have ZX_RIGHT_MANAGE_THREAD.
thread_start(resource struct {
handle handle:THREAD;
thread_entry vaddr;
stack vaddr;
arg1 uintptr;
arg2 uintptr;
}) -> (struct {
status status;
});
/// Read one aspect of thread state.
/// Rights: handle must be of type ZX_OBJ_TYPE_THREAD and have ZX_RIGHT_READ.
thread_read_state(resource struct {
handle handle:THREAD;
kind uint32;
}) -> (struct {
status status;
buffer vector_void;
});
/// Write one aspect of thread state.
/// Rights: handle must be of type ZX_OBJ_TYPE_THREAD and have ZX_RIGHT_WRITE.
thread_write_state(resource struct {
handle handle:THREAD;
kind uint32;
buffer vector_void;
}) -> (struct {
status status;
});
/// Yield the CPU of the current thread back to the scheduler.
/// Yield may result in other threads with similar importance running ahead of the
/// current thread, however, the exact behavior is unspecified.
///
/// |options| must be zero.
thread_legacy_yield(resource struct {
options uint32;
}) -> (struct {
status status;
});
};