Skip to main content

dr_suspend_all_other_threads_ex

Function dr_suspend_all_other_threads_ex 

Source
pub unsafe extern "C" fn dr_suspend_all_other_threads_ex(
    drcontexts: *mut *mut *mut c_void,
    num_suspended: *mut uint,
    num_unsuspended: *mut uint,
    flags: dr_suspend_flags_t,
) -> bool_
Expand description

Suspends all other threads in the process and returns an array of contexts in \p drcontexts with one context per successfully suspended thread. The contexts can be passed to routines like dr_get_thread_id() or dr_get_mcontext(). However, the contexts may not be modified: dr_set_mcontext() is not supported. dr_get_mcontext() can be called on the caller of this routine, unless in a Windows nudge callback.

The \p flags argument controls which threads are suspended and may add further options in the future.

The number of successfully suspended threads, which is also the length of the \p drcontexts array, is returned in \p num_suspended, which is a required parameter. The number of un-successfully suspended threads, if any, is returned in the optional parameter \p num_unsuspended. The calling thread is not considered in either count. DR can fail to suspend a thread for privilege reasons (e.g., on Windows in a low-privilege process where another process injected a thread). This function returns true iff all threads were suspended, in which case \p num_unsuspended will be 0.

The caller must invoke dr_resume_all_other_threads() in order to resume the suspended threads, free the \p drcontexts array, and release coarse-grain locks that prevent new threads from being created.

This routine may not be called from any registered event callback other than the nudge event or the pre- or post-system call event. It may be called from clean calls out of the cache. This routine may not be called while any locks are held that could block a thread processing a registered event callback or cache callout.

\note A client wishing to invoke this routine from an event callback can queue up a nudge via dr_nudge_client() and invoke this routine from the nudge callback.