#include <ib0mutex.h>
◆ MutexPolicy
template<template< typename > class Policy = NoPolicy>
◆ TTASEventMutex() [1/3]
template<template< typename > class Policy = NoPolicy>
◆ ~TTASEventMutex()
template<template< typename > class Policy = NoPolicy>
◆ TTASEventMutex() [2/3]
template<template< typename > class Policy = NoPolicy>
◆ TTASEventMutex() [3/3]
template<template< typename > class Policy = NoPolicy>
◆ clear_waiters()
template<template< typename > class Policy = NoPolicy>
Note that there are no threads waiting on the mutex.
◆ destroy()
template<template< typename > class Policy = NoPolicy>
This is the real destructor.
This mutex can be created in BSS and its destructor will be called on exit(). We can't call os_event_destroy() at that stage.
◆ enter()
template<template< typename > class Policy = NoPolicy>
void TTASEventMutex< Policy >::enter |
( |
uint32_t |
max_spins, |
|
|
uint32_t |
max_delay, |
|
|
const char * |
filename, |
|
|
uint32_t |
line |
|
) |
| |
|
inline |
Acquire the mutex.
- Parameters
-
[in] | max_spins | max number of spins |
[in] | max_delay | max delay per spin |
[in] | filename | from where called |
[in] | line | within filename |
◆ event()
template<template< typename > class Policy = NoPolicy>
The event that the mutex will wait in sync0arr.cc.
- Returns
- even instance
◆ exit()
template<template< typename > class Policy = NoPolicy>
◆ init()
template<template< typename > class Policy = NoPolicy>
Called when the mutex is "created".
Note: Not from the constructor but when the mutex is initialised.
- Parameters
-
[in] | id | Mutex ID |
[in] | filename | File where mutex was created |
[in] | line | Line in filename |
◆ is_free()
template<template< typename > class Policy = NoPolicy>
bool TTASEventMutex< Policy >::is_free |
( |
uint32_t |
max_spins, |
|
|
uint32_t |
max_delay, |
|
|
uint32_t & |
n_spins |
|
) |
| const |
|
inlineprivate |
Spin and wait for the mutex to become free.
- Parameters
-
[in] | max_spins | max spins |
[in] | max_delay | max delay per spin |
[in,out] | n_spins | spin start index |
- Returns
- true if unlocked
◆ is_locked()
template<template< typename > class Policy = NoPolicy>
- Returns
- true if locked by some thread
◆ is_owned()
template<template< typename > class Policy = NoPolicy>
- Returns
- true if the calling thread owns the mutex.
◆ operator=() [1/2]
template<template< typename > class Policy = NoPolicy>
◆ operator=() [2/2]
template<template< typename > class Policy = NoPolicy>
◆ peek_owner()
template<template< typename > class Policy = NoPolicy>
If the lock is locked, returns the current owner of the lock, otherwise returns the default std::thread::id{}.
◆ policy() [1/2]
template<template< typename > class Policy = NoPolicy>
- Returns
- non-const version of the policy
◆ policy() [2/2]
template<template< typename > class Policy = NoPolicy>
- Returns
- const version of the policy
◆ set_waiters()
template<template< typename > class Policy = NoPolicy>
Note that there are threads waiting on the mutex.
◆ signal()
template<template< typename > class Policy>
Wakeup any waiting thread(s).
◆ spin_and_try_lock()
template<template< typename > class Policy = NoPolicy>
void TTASEventMutex< Policy >::spin_and_try_lock |
( |
uint32_t |
max_spins, |
|
|
uint32_t |
max_delay, |
|
|
const char * |
filename, |
|
|
uint32_t |
line |
|
) |
| |
|
inlineprivate |
Spin while trying to acquire the mutex.
- Parameters
-
[in] | max_spins | max number of spins |
[in] | max_delay | max delay per spin |
[in] | filename | from where called |
[in] | line | within filename |
◆ try_lock()
template<template< typename > class Policy = NoPolicy>
Try and lock the mutex.
Note: POSIX returns 0 on success.
- Returns
- true on success
◆ wait()
template<template< typename > class Policy>
bool TTASEventMutex< Policy >::wait |
( |
const char * |
filename, |
|
|
uint32_t |
line, |
|
|
uint32_t |
spin |
|
) |
| |
|
private |
Wait in the sync array.
- Parameters
-
[in] | filename | from where it was called |
[in] | line | line number in file |
[in] | spin | retry this many times again |
- Returns
- true if the mutex acquisition was successful.
-
true if the mutex acquisition was successful.
◆ m_event
template<template< typename > class Policy = NoPolicy>
Used by sync0arr.cc for the wait queue.
◆ m_owner
template<template< typename > class Policy = NoPolicy>
Set to owner's thread's id when locked, and reset to the default std::thread::id{} when unlocked.
◆ m_policy
template<template< typename > class Policy = NoPolicy>
◆ m_waiters
template<template< typename > class Policy = NoPolicy>
true if there are (or may be) threads waiting in the global wait array for this mutex to be released.
The documentation for this struct was generated from the following files: