MySQL 8.0.39
Source Code Documentation
|
The interface to the threading wrapper. More...
#include <my_thread.h>
#include "univ.i"
#include "os0thread.h"
#include "sql_thd_internal_api.h"
#include <atomic>
#include <functional>
Go to the source code of this file.
Classes | |
class | MySQL_thread |
Register with MySQL infrastructure. More... | |
class | Runnable |
Execute in the context of a non detached MySQL thread. More... | |
class | Detached_thread |
Wrapper for a callable, it will count the number of registered Runnable instances and will register the thread executing the callable with the PFS and the Server threading infrastructure. More... | |
Macros | |
#define | os_thread_create(...) create_detached_thread(__VA_ARGS__) |
#define | par_for(...) par_for(__VA_ARGS__) |
Functions | |
void | os_thread_open () |
Initializes OS thread management data structures. More... | |
bool | os_thread_any_active () |
Check if there are threads active. More... | |
void | os_thread_close () |
Frees OS thread management data structures. More... | |
bool | thread_is_stopped (const IB_thread &thread) |
Check if thread is stopped. More... | |
bool | thread_is_active (const IB_thread &thread) |
Check if thread is active. More... | |
template<typename F , typename... Args> | |
IB_thread | create_detached_thread (mysql_pfs_key_t pfs_key, PSI_thread_seqnum pfs_seqnum, F &&f, Args &&... args) |
Create a detached non-started thread. More... | |
template<typename Container , typename F , typename... Args> | |
void | par_for (mysql_pfs_key_t pfs_key, const Container &c, size_t n, F &&f, Args &&... args) |
Parallel for loop over a container. More... | |
Variables | |
uint32_t | srv_max_n_threads |
Maximum number of threads inside InnoDB. More... | |
std::atomic_int | os_thread_count |
Number of threads active. More... | |
The interface to the threading wrapper.
Created 2016-May-17 Sunny Bains
#define os_thread_create | ( | ... | ) | create_detached_thread(__VA_ARGS__) |
#define par_for | ( | ... | ) | par_for(__VA_ARGS__) |
IB_thread create_detached_thread | ( | mysql_pfs_key_t | pfs_key, |
PSI_thread_seqnum | pfs_seqnum, | ||
F && | f, | ||
Args &&... | args | ||
) |
Create a detached non-started thread.
After thread is created, you should assign the received object to any of variables/fields which you later could access to check thread's state. You are allowed to either move or copy that object (any number of copies is allowed). After assigning you are allowed to start the thread by calling start() on any of those objects.
[in] | pfs_key | Performance schema thread key |
[in] | pfs_seqnum | Performance schema thread sequence number |
[in] | f | Callable instance |
[in] | args | Zero or more args |
|
inline |
Check if there are threads active.
|
inline |
Frees OS thread management data structures.
|
inline |
Initializes OS thread management data structures.
void par_for | ( | mysql_pfs_key_t | pfs_key, |
const Container & | c, | ||
size_t | n, | ||
F && | f, | ||
Args &&... | args | ||
) |
Parallel for loop over a container.
[in] | pfs_key | Performance schema thread key |
[in] | c | Container to iterate over in parallel |
[in] | n | Number of threads to create |
[in] | f | Callable instance |
[in] | args | Zero or more args |
|
inline |
Check if thread is active.
[in] | thread | Thread handle. |
|
inline |
Check if thread is stopped.
[in] | thread | Thread handle. |
|
extern |
Number of threads active.
|
extern |
Maximum number of threads inside InnoDB.
Maximum number of threads inside InnoDB.
innodb_init_params() sets the value.