Utility class to allow RAII pattern with MDL_request
and MDL_context
classes.
More...
#include <rpl_rli.h>
Utility class to allow RAII pattern with MDL_request
and MDL_context
classes.
◆ MDL_lock_guard() [1/2]
MDL_lock_guard::MDL_lock_guard |
( |
THD * |
target | ) |
|
Constructor that initializes the object and the target THD
object but doesn't try to acquire any lock.
- Parameters
-
target | THD object, source for the MDL_context to use. |
◆ MDL_lock_guard() [2/2]
Constructor that initializes the object and the target THD
object and tries to acquire the lock identified by namespace_arg
with MDL type identified by mdl_type_arg
.
If the blocking
parameter is true, it will instantly try to acquire the lock and block. If the blocking
parameter is false, it will first test if the lock is already acquired and only try to lock if no conflicting lock is already acquired.
- Parameters
-
target | THD object, source for the MDL_context to use. |
namespace_arg | MDL key namespace to acquire the lock from. |
mdl_type_arg | MDL acquisition type |
blocking | whether or not the execution should block if the lock is already acquired. |
◆ ~MDL_lock_guard()
MDL_lock_guard::~MDL_lock_guard |
( |
| ) |
|
|
virtual |
Destructor that unlocks all acquired locks.
◆ is_locked()
bool MDL_lock_guard::is_locked |
( |
| ) |
|
Returns whether or not the lock as been acquired within this object life-cycle.
- Returns
- true if the lock has been acquired within this object life-cycle.
◆ lock()
Uses the target THD
object MDL context to acquire the lock identified by namespace_arg
with MDL type identified by mdl_type_arg
.
If the blocking
parameter is true, it will instantly try to acquire the lock and block. If the blocking
parameter is false, it will first test if the lock is already acquired and only try to lock if no conflicting lock is already acquired.
The lock is determined to have been acquired if the THD
object MDL context hasn't already a lock and the lock is acquired. In other words, if the MDL context already has acquired the lock, the method will return failure.
- Parameters
-
namespace_arg | MDL key namespace to acquire the lock from. |
mdl_type_arg | MDL acquisition type |
blocking | whether or not the execution should block if the lock is already acquired. |
- Returns
- false if the lock has been acquired by this method invocation and true if not.
◆ m_request
The MDL request holding the MDL ticket issued upon acquisition.
◆ m_target
THD* MDL_lock_guard::m_target |
|
private |
The THD
object holding the MDL context used for acquiring/releasing.
The documentation for this class was generated from the following files: