#include <os/object.h>

os/object.h Kernel.framework

@header @preprocinfo By default, libSystem objects such as GCD and XPC objects are declared as Objective-C types when building with an Objective-C compiler. This allows them to participate in ARC, in RR management by the Blocks runtime and in leaks checking by the static analyzer, and enables them to be added to Cocoa collections. NOTE: this requires explicit cancellation of dispatch sources and xpc connections whose handler blocks capture the source/connection object, resp. ensuring that such captures do not form retain cycles (e.g. by declaring the source as __weak). To opt-out of this default behavior, add -DOS_OBJECT_USE_OBJC=0 to your compiler flags. This mode requires a platform with the modern Objective-C runtime, the Objective-C GC compiler option to be disabled, and at least a Mac OS X 10.8 or iOS 6.0 deployment target.
includes: Availability.h, os/base.h
2 functions · 2 macros

functionos_retain

__OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0)
OS_EXPORT void* os_retain(void *object)
@function os_retain @abstract Increment the reference count of an os_object. @discussion On a platform with the modern Objective-C runtime this is exactly equivalent to sending the object the -[retain] message. @param object The object to retain. @result The retained object.

functionos_release

__OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0)
OS_EXPORT void os_release(void *object)
@function os_release @abstract Decrement the reference count of a os_object. @discussion On a platform with the modern Objective-C runtime this is exactly equivalent to sending the object the -[release] message. @param object The object to release.

macrofastpath

#define fastpath(x) ((typeof(x))__builtin_expect((long)(x), ~0l))

macroslowpath

#define slowpath(x) ((typeof(x))__builtin_expect((long)(x), 0l))