Moved run_SetAllSession_ToProcess0 to Base_Thread

v2.x_pg_PrepStmtBase_240714
René Cannaò 2 years ago
parent 210d3127c1
commit 2d7806c325

@ -42,6 +42,7 @@ class Base_Thread {
public:
unsigned long long curtime;
unsigned long long last_move_to_idle_thread_time;
bool epoll_thread;
int shutdown;
PtrArray *mysql_sessions;
Session_Regex **match_regexes;
@ -74,6 +75,7 @@ class Base_Thread {
#endif // IDLE_THREADS
template<typename T, typename S> unsigned int find_session_idx_in_mysql_sessions(S * sess);
template<typename T> void ProcessAllMyDS_BeforePoll();
template<typename T, typename S> void run_SetAllSession_ToProcess0();
friend class MySQL_Thread;
friend class PgSQL_Thread;

@ -139,7 +139,7 @@ class __attribute__((aligned(64))) MySQL_Thread : public Base_Thread
void run_BootstrapListener();
int run_ComputePollTimeout();
void run_StopListener();
void run_SetAllSession_ToProcess0();
//void run_SetAllSession_ToProcess0();
protected:
@ -170,7 +170,7 @@ class __attribute__((aligned(64))) MySQL_Thread : public Base_Thread
// int shutdown;
kill_queue_t kq;
bool epoll_thread;
//bool epoll_thread;
bool poll_timeout_bool;
// status variables are per thread only

@ -181,7 +181,7 @@ public:
int pipefd[2];
kill_queue_t kq;
bool epoll_thread;
//bool epoll_thread;
bool poll_timeout_bool;
// status variables are per thread only

@ -19,6 +19,8 @@ template void Base_Thread::ProcessAllMyDS_BeforePoll<MySQL_Thread>();
template void Base_Thread::ProcessAllMyDS_BeforePoll<PgSQL_Thread>();
template void Base_Thread::register_session(MySQL_Thread*, MySQL_Session*, bool);
template void Base_Thread::register_session(PgSQL_Thread*, PgSQL_Session*, bool);
template void Base_Thread::run_SetAllSession_ToProcess0<MySQL_Thread, MySQL_Session>();
template void Base_Thread::run_SetAllSession_ToProcess0<PgSQL_Thread, PgSQL_Session>();
Base_Thread::Base_Thread() {
};
@ -468,3 +470,20 @@ void Base_Thread::ProcessAllMyDS_BeforePoll() {
}
}
template<typename T, typename S>
void Base_Thread::run_SetAllSession_ToProcess0() {
T* thr = static_cast<T*>(this);
unsigned int n;
#ifdef IDLE_THREADS
// @note: in MySQL_Thread::run we have: bool idle_maintenance_thread=epoll_thread;
// Thus idle_maintenance_thread and epoll_thread are equivalent.
if (epoll_thread==false) {
#endif // IDLE_THREADS
for (n=0; n<mysql_sessions->len; n++) {
S *_sess=(S *)mysql_sessions->index(n);
_sess->to_process=0;
}
#ifdef IDLE_THREADS
}
#endif // IDLE_THREADS
}

@ -3140,24 +3140,6 @@ void MySQL_Thread::run_StopListener() {
}
}
void MySQL_Thread::run_SetAllSession_ToProcess0() {
unsigned int n;
#ifdef IDLE_THREADS
// @note: in MySQL_Thread::run we have: bool idle_maintenance_thread=epoll_thread;
// Thus idle_maintenance_thread and epoll_thread are equivalent.
if (epoll_thread==false) {
#endif // IDLE_THREADS
for (n=0; n<mysql_sessions->len; n++) {
MySQL_Session *_sess=(MySQL_Session *)mysql_sessions->index(n);
_sess->to_process=0;
}
#ifdef IDLE_THREADS
}
#endif // IDLE_THREADS
}
// main loop
/**
* @brief Main loop for the MySQL thread.
@ -3321,7 +3303,7 @@ __run_skip_1:
refresh_variables();
}
run_SetAllSession_ToProcess0();
run_SetAllSession_ToProcess0<MySQL_Thread,MySQL_Session>();
#ifdef IDLE_THREADS
// here we handle epoll_wait()

@ -3081,16 +3081,7 @@ void PgSQL_Thread::run() {
refresh_variables();
}
#ifdef IDLE_THREADS
if (idle_maintenance_thread == false) {
#endif // IDLE_THREADS
for (n = 0; n < mysql_sessions->len; n++) {
PgSQL_Session* _sess = (PgSQL_Session*)mysql_sessions->index(n);
_sess->to_process = 0;
}
#ifdef IDLE_THREADS
}
#endif // IDLE_THREADS
run_SetAllSession_ToProcess0<PgSQL_Thread,PgSQL_Session>();
#ifdef IDLE_THREADS
// here we handle epoll_wait()

Loading…
Cancel
Save