Is there any case in which, in a single thread, pre-hooks that add thread-local callbacks and the StartCallback
function of those callbacks will occur out of order of each other? For the sake of simplicity, let’s say that addThreadLocalCallback
is called only with RecordScope::Function
This is to say, could it ever be the case that you have a call chain like:
- forward pre_hook for Module instance 1
- forward pre_hook for Module instance 2
- StartCallback from LocalCallbackManager is induced by an operation associated with Module 1, but not Module 2
- forward post_hook for Module 1 is called
- forward post_hook for Module 2 is called
as opposed to:
- forward pre_hook for Module instance 1
- forward pre_hook for Module instance 2
- StartCallback from LocalCallbackManager is induced by an operation associated with Module 2 (and also Module 1 if module 1 calls module 2)
- forward post_hook for Module 2 is called
- forward post_hook for Module 1 is called
Perhaps more succinctly-- if a forward pre_op hook is called and calls addThreadLocalCallback
, will the next operation for that specific thread only ever be one of the following:
- the StartCallback is called
- the forward post_op hook is called
- A different forward pre-op hook is called
I’m interested in any possible corner case here, including with asynchronous execution and with tasks pausing/resuming in a way that’s not observable from the APIs that I talked about.