My Project
|
Public Member Functions | |
Thread_excursion (THD *thd) | |
void | try_to_attach_to (THD *thd) |
Helper class to perform a thread excursion.
This class is used to temporarily switch to another session (THD structure). It will set up thread specific "globals" correctly so that the POSIX thread looks exactly like the session attached to. However, PSI_thread info is not touched as it is required to show the actual physial view in PFS instrumentation i.e., it should depict as the real thread doing the work instead of thread it switched to.
On destruction, the original session (which is supplied to the constructor) will be re-attached automatically. For example, with this code, the value of current_thd
will be the same before and after execution of the code.
{ Thread_excursion excursion(current_thd); for (int i = 0 ; i < count ; ++i) excursion.attach_to(other_thd[i]); }
void Thread_excursion::try_to_attach_to | ( | THD * | thd | ) | [inline] |
Try to attach the POSIX thread to a session.
[in] | thd | The thd of a session |