Skip to content

Commit 6eec7d4

Browse files
committedNov 16, 2016
[XRay][docs] Define requirements on installed log handlers.
Summary: We update the documentation to define what the requirements are for the provided XRay log handler. This is to make it clear that the function pointer provided must do internal synchronisation and that there are no guarantees provided by XRay on when the function shall be invoked once it has been installed as a log handler. Reviewers: rSerge, rengolin Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D26651 llvm-svn: 287073
1 parent 23f441d commit 6eec7d4

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
 

‎llvm/docs/XRay.rst

+13
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,19 @@ functions we list below:
162162
- ``__xray_unpatch()``: Unpatch the instrumentation points defined in the
163163
binary.
164164

165+
There are some requirements on the logging handler to be installed for the
166+
thread-safety of operations to be performed by the XRay runtime library:
167+
168+
- The function should be thread-safe, as multiple threads may be invoking the
169+
function at the same time. If the logging function needs to do
170+
synchronisation, it must do so internally as XRay does not provide any
171+
synchronisation guarantees outside from the atomicity of updates to the
172+
pointer.
173+
- The pointer provided to ``__xray_set_handler(...)`` must be live even after
174+
calls to ``__xray_remove_handler()`` and ``__xray_unpatch()`` have succeeded.
175+
XRay cannot guarantee that all threads that have ever gotten a copy of the
176+
pointer will not invoke the function.
177+
165178

166179
Trace Analysis Tools
167180
--------------------

0 commit comments

Comments
 (0)
Please sign in to comment.