| 1 | /* |
| 2 | * Copyright (c) 2023 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 _DISPATCH_SWIFT_SHIMS_ |
| 22 | #define _DISPATCH_SWIFT_SHIMS_ |
| 23 | |
| 24 | #ifndef __DISPATCH_INDIRECT__ |
| 25 | #error "This file is intended to be used only for Dispatch Swift Overlay." |
| 26 | #include <dispatch/base.h> // for HeaderDoc |
| 27 | #endif |
| 28 | |
| 29 | DISPATCH_ASSUME_NONNULL_BEGIN |
| 30 | DISPATCH_ASSUME_ABI_SINGLE_BEGIN |
| 31 | |
| 32 | __BEGIN_DECLS |
| 33 | |
| 34 | #ifdef __swift__ |
| 35 | DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT |
| 36 | DISPATCH_NOTHROW |
| 37 | DISPATCH_REFINED_FOR_SWIFT DISPATCH_SWIFT_NAME(DispatchSerialQueue.init(__label:attr:queue:)) |
| 38 | static inline dispatch_queue_serial_t |
| 39 | dispatch_serial_queue_create_with_target_4swift(const char *_Nullable DISPATCH_UNSAFE_INDEXABLE label, |
| 40 | 		dispatch_queue_attr_t _Nullable attr, dispatch_queue_t _Nullable target) { |
| 41 | 	return (dispatch_queue_serial_t) |
| 42 | 			dispatch_queue_create_with_target(label, attr, target); |
| 43 | } |
| 44 | |
| 45 | DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT |
| 46 | DISPATCH_NOTHROW |
| 47 | DISPATCH_REFINED_FOR_SWIFT DISPATCH_SWIFT_NAME(DispatchConcurrentQueue.init(__label:attr:queue:)) |
| 48 | static inline dispatch_queue_concurrent_t |
| 49 | dispatch_concurrent_queue_create_with_target_4swift(const char *_Nullable DISPATCH_UNSAFE_INDEXABLE label, |
| 50 | 		dispatch_queue_attr_t _Nullable attr, dispatch_queue_t _Nullable target) { |
| 51 | 	return (dispatch_queue_concurrent_t) |
| 52 | 			dispatch_queue_create_with_target(label, attr, target); |
| 53 | } |
| 54 | #endif |
| 55 | |
| 56 | __END_DECLS |
| 57 | |
| 58 | DISPATCH_ASSUME_ABI_SINGLE_END |
| 59 | DISPATCH_ASSUME_NONNULL_END |
| 60 | |
| 61 | #endif /* _DISPATCH_SWIFT_SHIMS_ */ |