1// Copyright 2017 The Fuchsia Authors. All rights reserved. 2// 3// Use of this source code is governed by a BSD-style license that can be 4// found in the LICENSE file. 5 6#pragma once 7 8#include <zircon/types.h> 9 10// This file contains thread functions that do various things useful for testing thread behavior. 11 12// The arg is a zx_time_t which is passed to zx_nanosleep. 13void threads_test_sleep_fn(void* arg); 14 15// The arg is an event. It will first be waited on for signal 0, then it will issue signal 1 to 16// notify completion. 17void threads_test_wait_fn(void* arg); 18void threads_test_wait_detach_fn(void* arg); 19 20// The arg is an event which will be waited on for signal 0 (to synchronize the beginning), then 21// it will issue a debug break instruction (causing a SW_BREAKPOINT exception), then it will sleep 22// infinitely. 23void threads_test_wait_break_infinite_sleep_fn(void* arg); 24 25// This thread function busyloops forever. The arg is ignored. 26void threads_test_busy_fn(void* arg); 27 28// This thread function sleeps forever. The arg is ignored. 29void threads_test_infinite_sleep_fn(void* arg); 30 31// This thread issues an infinite wait on signal 0 of the event whose handle is passed in arg. 32void threads_test_infinite_wait_fn(void* arg); 33 34// The arg is a port handle which is waited on. When a packet is received, it will send a packet 35// to the port whose key is 5 greater than the input key. 36void threads_test_port_fn(void* arg); 37 38// The arg is a pointer to channel_call_suspend_test_arg (below). The function will send a small 39// message and expects to receive the same contents in a reply. 40// 41// On completion, arg->call_status will be set to the success of the operation. 42void threads_test_channel_call_fn(void* arg); 43 44struct channel_call_suspend_test_arg { 45 zx_handle_t channel; 46 zx_status_t call_status; 47}; 48