]> git.saurik.com Git - apple/libpthread.git/blob - pthread/spawn.h
libpthread-218.51.1.tar.gz
[apple/libpthread.git] / pthread / spawn.h
1 /*
2 * Copyright (c) 2014 Apple Inc. All rights reserved.
3 *
4 * @APPLE_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. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24 #ifndef _PTHREAD_SPAWN_H
25 #define _PTHREAD_SPAWN_H
26
27 /*!
28 * @group posix_spawn QOS class support
29 * Apple extensions to posix_spawn(2) and posix_spawnp(2)
30 */
31
32 #include <pthread/pthread.h>
33 #include <spawn.h>
34
35 __BEGIN_DECLS
36
37 /*!
38 * @function posix_spawnattr_set_qos_class_np
39 *
40 * @abstract
41 * Sets the QOS class property of a posix_spawn attributes object, which may be
42 * used to specify the QOS class a process should be spawned with.
43 *
44 * @discussion
45 * The QOS class specified at the time of process spawn determines both the
46 * initial requested QOS class of the main thread in the new process, and the
47 * interpretation by the system of all QOS class values requested by threads in
48 * the process.
49 *
50 * @param __attr
51 * The spawn attributes object to modify.
52 *
53 * @param __qos_class
54 * A QOS class value:
55 * - QOS_CLASS_UTILITY
56 * - QOS_CLASS_BACKGROUND
57 * EINVAL will be returned if any other value is provided.
58 *
59 * @return
60 * Zero if successful, otherwise an errno value.
61 */
62 __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0)
63 int
64 posix_spawnattr_set_qos_class_np(posix_spawnattr_t * __restrict __attr,
65 qos_class_t __qos_class);
66
67 /*!
68 * @function posix_spawnattr_get_qos_class_np
69 *
70 * @abstract
71 * Gets the QOS class property of a posix_spawn attributes object.
72 *
73 * @param __attr
74 * The spawn attributes object to inspect.
75 *
76 * @param __qos_class
77 * On output, a QOS class value:
78 * - QOS_CLASS_UTILITY
79 * - QOS_CLASS_BACKGROUND
80 * - QOS_CLASS_UNSPECIFIED
81 *
82 * @return
83 * Zero if successful, otherwise an errno value.
84 */
85 __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0)
86 int
87 posix_spawnattr_get_qos_class_np(const posix_spawnattr_t *__restrict __attr,
88 qos_class_t * __restrict __qos_class);
89
90 __END_DECLS
91
92 #endif // _PTHREAD_SPAWN_H