00001 /* 00002 * Copyright (c) 2008-2009 Apple Inc. All rights reserved. 00003 * 00004 * @APPLE_APACHE_LICENSE_HEADER_START@ 00005 * 00006 * Licensed under the Apache License, Version 2.0 (the "License"); 00007 * you may not use this file except in compliance with the License. 00008 * You may obtain a copy of the License at 00009 * 00010 * http://www.apache.org/licenses/LICENSE-2.0 00011 * 00012 * Unless required by applicable law or agreed to in writing, software 00013 * distributed under the License is distributed on an "AS IS" BASIS, 00014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 * See the License for the specific language governing permissions and 00016 * limitations under the License. 00017 * 00018 * @APPLE_APACHE_LICENSE_HEADER_END@ 00019 */ 00020 00021 #ifndef __DISPATCH_SEMAPHORE__ 00022 #define __DISPATCH_SEMAPHORE__ 00023 00024 #ifndef __DISPATCH_INDIRECT__ 00025 #error "Please #include <xdispatch/dispatch.h> instead of this file directly." 00026 #include <dispatch/base.h> // for HeaderDoc 00027 #endif 00028 00035 DISPATCH_DECL(dispatch_semaphore); 00036 00037 __DISPATCH_BEGIN_DECLS 00038 00058 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0) 00059 DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_NOTHROW 00060 dispatch_semaphore_t 00061 dispatch_semaphore_create(long value); 00062 00083 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0) 00084 DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW 00085 long 00086 dispatch_semaphore_wait(dispatch_semaphore_t dsema, dispatch_time_t timeout); 00087 00105 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0) 00106 DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW 00107 long 00108 dispatch_semaphore_signal(dispatch_semaphore_t dsema); 00109 00110 __DISPATCH_END_DECLS 00111 00112 #endif /* __DISPATCH_SEMAPHORE__ */