zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

dispatch_swift_shims.h (2064B) - Raw


      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_create_with_target(label, attr, target);
     42 }
     43 
     44 DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT
     45 DISPATCH_NOTHROW
     46 DISPATCH_REFINED_FOR_SWIFT DISPATCH_SWIFT_NAME(DispatchConcurrentQueue.init(__label:attr:queue:))
     47 static inline dispatch_queue_concurrent_t
     48 dispatch_concurrent_queue_create_with_target_4swift(const char *_Nullable DISPATCH_UNSAFE_INDEXABLE label,
     49 		dispatch_queue_attr_t _Nullable attr, dispatch_queue_t _Nullable target) {
     50 	return dispatch_queue_create_with_target(label, attr, target);
     51 }
     52 #endif
     53 
     54 __END_DECLS
     55 
     56 DISPATCH_ASSUME_ABI_SINGLE_END
     57 DISPATCH_ASSUME_NONNULL_END
     58 
     59 #endif /* _DISPATCH_SWIFT_SHIMS_ */