MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thread_excursion Class Reference

Public Member Functions

 Thread_excursion (THD *thd)
void try_to_attach_to (THD *thd)

Detailed Description

Helper class to perform a thread excursion.

This class is used to temporarily switch to another session (THD structure). It will set up the PSI structures and other "globals" correctly (e.g., thread-specific variables) so that the POSIX thread looks exactly like the session attached 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]);
}
Warning
The class is not designed to be inherited from.

Definition at line 176 of file binlog.cc.

Member Function Documentation

void Thread_excursion::try_to_attach_to ( THD *  thd)
inline

Try to attach the POSIX thread to a session.

  • This function attaches the POSIX thread to a session in MAX_SESSION_ATTACH_TRIES tries when encountering 'out of memory' error, and terminates the server after failed in MAX_SESSION_ATTACH_TRIES tries.
Parameters
[in]thdThe thd of a session

Definition at line 207 of file binlog.cc.


The documentation for this class was generated from the following file: