mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
MDEV-35273 tpool::worker_data - replace MY_ALIGNED with pad member
This commit is contained in:
parent
953f847aed
commit
d64034770e
1 changed files with 3 additions and 21 deletions
|
@ -137,7 +137,7 @@ enum worker_wake_reason
|
|||
|
||||
|
||||
/* A per-worker thread structure.*/
|
||||
struct MY_ALIGNED(CPU_LEVEL1_DCACHE_LINESIZE) worker_data
|
||||
struct worker_data
|
||||
{
|
||||
/** Condition variable to wakeup this worker.*/
|
||||
std::condition_variable m_cv;
|
||||
|
@ -164,6 +164,8 @@ struct MY_ALIGNED(CPU_LEVEL1_DCACHE_LINESIZE) worker_data
|
|||
};
|
||||
|
||||
int m_state;
|
||||
/* Padding to avoid false sharing */
|
||||
char m_pad[CPU_LEVEL1_DCACHE_LINESIZE];
|
||||
|
||||
bool is_executing_task()
|
||||
{
|
||||
|
@ -187,26 +189,6 @@ struct MY_ALIGNED(CPU_LEVEL1_DCACHE_LINESIZE) worker_data
|
|||
m_state(NONE),
|
||||
m_task_start_time()
|
||||
{}
|
||||
|
||||
/*Define custom new/delete because of overaligned structure. */
|
||||
void* operator new(size_t size)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return _aligned_malloc(size, CPU_LEVEL1_DCACHE_LINESIZE);
|
||||
#else
|
||||
void* ptr;
|
||||
int ret = posix_memalign(&ptr, CPU_LEVEL1_DCACHE_LINESIZE, size);
|
||||
return ret ? 0 : ptr;
|
||||
#endif
|
||||
}
|
||||
void operator delete(void* p)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
_aligned_free(p);
|
||||
#else
|
||||
free(p);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue