| 1 | /* |
| 2 | * Copyright (c) 2020 Apple Inc. All rights reserved. |
| 3 | * |
| 4 | * @APPLE_APACHE_LICENSE_HEADER_START@ |
| 5 | * |
| 6 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | * you may not use this file except in compliance with the License. |
| 8 | * You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, software |
| 13 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | * See the License for the specific language governing permissions and |
| 16 | * limitations under the License. |
| 17 | * |
| 18 | * @APPLE_APACHE_LICENSE_HEADER_END@ |
| 19 | */ |
| 20 | |
| 21 | #ifndef __OS_WORKGROUP_PARALLEL__ |
| 22 | #define __OS_WORKGROUP_PARALLEL__ |
| 23 | |
| 24 | #ifndef __OS_WORKGROUP_INDIRECT__ |
| 25 | #error "Please #include <os/workgroup.h> instead of this file directly." |
| 26 | #include <os/workgroup_base.h> // For header doc |
| 27 | #endif |
| 28 | |
| 29 | #include <os/workgroup_object.h> |
| 30 | |
| 31 | __BEGIN_DECLS |
| 32 | |
| 33 | OS_WORKGROUP_ASSUME_NONNULL_BEGIN |
| 34 | OS_WORKGROUP_ASSUME_ABI_SINGLE_BEGIN |
| 35 | |
| 36 | /*! |
| 37 | * @typedef os_workgroup_parallel_t |
| 38 | * |
| 39 | * @abstract |
| 40 | * A subclass of an os_workgroup_t for tracking parallel work. |
| 41 | */ |
| 42 | OS_WORKGROUP_SUBCLASS_DECL_PROTO(os_workgroup_parallel, Parallelizable); |
| 43 | OS_WORKGROUP_SUBCLASS_DECL(os_workgroup_parallel, os_workgroup, WorkGroupParallel); |
| 44 | |
| 45 | /*! |
| 46 | * @function os_workgroup_parallel_create |
| 47 | * |
| 48 | * @abstract |
| 49 | * Creates an os_workgroup_t which tracks a parallel workload. |
| 50 | * A newly created os_workgroup_interval_t has no initial member threads - |
| 51 | * in particular the creating thread does not join the os_workgroup_parallel_t |
| 52 | * implicitly. |
| 53 | * |
| 54 | * See also os_workgroup_max_parallel_threads(). |
| 55 | * |
| 56 | * @param name |
| 57 | * A client specified string for labelling the workgroup. This parameter is |
| 58 | * optional and can be NULL. |
| 59 | * |
| 60 | * @param attr |
| 61 | * The requested set of workgroup attributes. NULL is to be specified for the |
| 62 | * default set of attributes. |
| 63 | */ |
| 64 | API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0)) |
| 65 | OS_WORKGROUP_EXPORT OS_WORKGROUP_RETURNS_RETAINED |
| 66 | OS_SWIFT_NAME(WorkGroupParallel.init(__name:attr:)) |
| 67 | os_workgroup_parallel_t _Nullable |
| 68 | os_workgroup_parallel_create(const char *OS_WORKGROUP_UNSAFE_INDEXABLE _Nullable name, |
| 69 | 	os_workgroup_attr_t _Nullable attr); |
| 70 | |
| 71 | OS_WORKGROUP_ASSUME_ABI_SINGLE_END |
| 72 | OS_WORKGROUP_ASSUME_NONNULL_END |
| 73 | |
| 74 | __END_DECLS |
| 75 | |
| 76 | #endif /* __OS_WORKGROUP_PARALLEL__ */ |