1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
|
/*
* Copyright (c) 2013 Apple Inc. All rights reserved.
*
* @APPLE_APACHE_LICENSE_HEADER_START@
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @APPLE_APACHE_LICENSE_HEADER_END@
*/
#ifndef __DISPATCH_INTROSPECTION__
#define __DISPATCH_INTROSPECTION__
#include <dispatch/dispatch.h>
DISPATCH_ASSUME_NONNULL_BEGIN
/*!
* @header
*
* @abstract
* Interposable introspection hooks for libdispatch.
*
* @discussion
* These hooks are only available in the introspection version of the library,
* loaded by running a process with the environment variable
* DYLD_LIBRARY_PATH=/usr/lib/system/introspection
*/
__BEGIN_DECLS
/*!
* @function dispatch_introspection_hook_queue_create
*
* @abstract
* Interposable hook function called when a dispatch queue was created.
*
* @param queue
* The newly created dispatch queue.
*/
API_AVAILABLE(macos(10.9), ios(7.0))
DISPATCH_EXPORT
void
dispatch_introspection_hook_queue_create(dispatch_queue_t queue);
/*!
* @function dispatch_introspection_hook_queue_destroy
*
* @abstract
* Interposable hook function called when a dispatch queue is about to be
* destroyed.
*
* @param queue
* The dispatch queue about to be destroyed.
*/
API_AVAILABLE(macos(10.9), ios(7.0))
DISPATCH_EXPORT
void
dispatch_introspection_hook_queue_destroy(dispatch_queue_t queue);
/*!
* @function dispatch_introspection_hook_queue_item_enqueue
*
* @abstract
* Interposable hook function called when an item is about to be enqueued onto
* a dispatch queue.
*
* @param queue
* The dispatch queue enqueued onto.
*
* @param item
* The object about to be enqueued.
*/
API_AVAILABLE(macos(10.9), ios(7.0))
DISPATCH_EXPORT
void
dispatch_introspection_hook_queue_item_enqueue(dispatch_queue_t queue,
dispatch_object_t item);
/*!
* @function dispatch_introspection_hook_queue_item_dequeue
*
* @abstract
* Interposable hook function called when an item was dequeued from a dispatch
* queue.
*
* @param queue
* The dispatch queue dequeued from.
*
* @param item
* The dequeued object.
*/
API_AVAILABLE(macos(10.9), ios(7.0))
DISPATCH_EXPORT
void
dispatch_introspection_hook_queue_item_dequeue(dispatch_queue_t queue,
dispatch_object_t item);
/*!
* @function dispatch_introspection_hook_queue_item_complete
*
* @abstract
* Interposable hook function called when an item previously dequeued from a
* dispatch queue has completed processing.
*
* @discussion
* The object pointer value passed to this function must be treated as a value
* only. It is intended solely for matching up with an earlier call to a
* dequeue hook function and must NOT be dereferenced.
*
* @param item
* Opaque dentifier for completed item. Must NOT be dereferenced.
*/
API_AVAILABLE(macos(10.10), ios(7.1))
DISPATCH_EXPORT
void
dispatch_introspection_hook_queue_item_complete(dispatch_object_t item);
/*!
* @function dispatch_introspection_hook_queue_callout_begin
*
* @abstract
* Interposable hook function called when a client function is about to be
* called out to on a dispatch queue.
*
* @param queue
* The dispatch queue the callout is performed on.
*
* @param context
* The context parameter passed to the function. For a callout to a block,
* this is a pointer to the block object.
*
* @param function
* The client function about to be called out to. For a callout to a block,
* this is the block object's invoke function.
*/
API_AVAILABLE(macos(10.9), ios(7.0))
DISPATCH_EXPORT
void
dispatch_introspection_hook_queue_callout_begin(dispatch_queue_t queue,
void *_Nullable context, dispatch_function_t function);
/*!
* @function dispatch_introspection_hook_queue_callout_end
*
* @abstract
* Interposable hook function called after a client function has returned from
* a callout on a dispatch queue.
*
* @param queue
* The dispatch queue the callout was performed on.
*
* @param context
* The context parameter passed to the function. For a callout to a block,
* this is a pointer to the block object.
*
* @param function
* The client function that was called out to. For a callout to a block,
* this is the block object's invoke function.
*/
API_AVAILABLE(macos(10.9), ios(7.0))
DISPATCH_EXPORT
void
dispatch_introspection_hook_queue_callout_end(dispatch_queue_t queue,
void *_Nullable context, dispatch_function_t function);
__END_DECLS
DISPATCH_ASSUME_NONNULL_END
#endif
|