]>
Commit | Line | Data |
---|---|---|
5ba3f43e A |
1 | /* |
2 | * Copyright (c) 2017 Apple Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * This file contains Original Code and/or Modifications of Original Code | |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. The rights granted to you under the License | |
10 | * may not be used to create, or enable the creation or redistribution of, | |
11 | * unlawful or unlicensed copies of an Apple operating system, or to | |
12 | * circumvent, violate, or enable the circumvention or violation of, any | |
13 | * terms of an Apple operating system software license agreement. | |
14 | * | |
15 | * Please obtain a copy of the License at | |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
17 | * | |
18 | * The Original Code and all software distributed under the License are | |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
23 | * Please see the License for the specific language governing rights and | |
24 | * limitations under the License. | |
25 | * | |
26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ | |
27 | */ | |
28 | ||
29 | #ifndef _KERN_WORK_INTERVAL_H_ | |
30 | #define _KERN_WORK_INTERVAL_H_ | |
31 | ||
32 | #include <sys/cdefs.h> | |
33 | ||
34 | #include <stdint.h> | |
35 | #include <kern/kern_types.h> | |
36 | ||
37 | #include <kern/thread_group.h> | |
38 | ||
39 | __BEGIN_DECLS | |
40 | ||
41 | struct work_interval; | |
42 | ||
43 | struct kern_work_interval_args { | |
44 | uint64_t work_interval_id; | |
45 | uint64_t start; | |
46 | uint64_t finish; | |
47 | uint64_t deadline; | |
48 | uint64_t next_start; | |
49 | uint32_t notify_flags; | |
50 | uint32_t create_flags; | |
51 | uint16_t urgency; | |
52 | }; | |
53 | ||
54 | struct kern_work_interval_create_args { | |
55 | uint64_t wica_id; /* out param */ | |
56 | uint32_t wica_port; /* out param */ | |
57 | uint32_t wica_create_flags; | |
58 | }; | |
59 | ||
60 | /* | |
61 | * Allocate/assign a single work interval ID for a thread, | |
62 | * and support deallocating it. | |
63 | */ | |
64 | extern kern_return_t | |
65 | kern_work_interval_create(thread_t thread, struct kern_work_interval_create_args *create_params); | |
a39ff7e2 | 66 | |
5ba3f43e A |
67 | extern kern_return_t |
68 | kern_work_interval_destroy(thread_t thread, uint64_t work_interval_id); | |
69 | extern kern_return_t | |
70 | kern_work_interval_join(thread_t thread, mach_port_name_t port_name); | |
71 | ||
5ba3f43e A |
72 | extern kern_return_t |
73 | kern_work_interval_notify(thread_t thread, struct kern_work_interval_args* kwi_args); | |
74 | ||
75 | #ifdef MACH_KERNEL_PRIVATE | |
76 | ||
77 | extern void work_interval_port_notify(mach_msg_header_t *msg); | |
78 | ||
79 | ||
80 | extern void work_interval_thread_terminate(thread_t thread); | |
81 | ||
82 | #endif /* MACH_KERNEL_PRIVATE */ | |
83 | ||
84 | __END_DECLS | |
85 | ||
86 | #endif /* !defined(_KERN_WORK_INTERVAL_H_) */ |