You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
proxysql/include/mysql_thread.h_

59 lines
1.1 KiB

#ifndef __CLASS_MYSQL_THREAD_H
#define __CLASS_MYSQL_THREAD_H
#include "proxysql.h"
#include "cpp.h"
#define MYSQL_THREAD_EPOLL_MAXEVENTS 1000
#define MIN_POLL_FDS_PER_THREAD 1024
// thyis structure tries to emulate epoll()
typedef struct _proxy_poll_t {
int nfds;
int max_nfds;
struct pollfd *fds;
MySQL_Data_Stream **myds;
} proxy_poll_t;
class MySQL_Thread
{
private:
//int epoll_maxevents;
//struct epoll_event *events;
int nfds;
/*
struct pollfd *poll_fds;
int poll_max_nfds;
*/
public:
pthread_t thread_id;
proxy_poll_t mypolls;
int shutdown;
//Local_Query_Cache *LQC;
//int epollfd;
PtrArray *mysql_sessions;
/*
int hostgroup_id;
MySQL_Data_Stream *server_myds;
mysql_cp_entry_t *server_mycpe;
bytes_stats_t server_bytes_at_cmd;
*/
MySQL_Thread();
~MySQL_Thread();
void init();
//int init_epoll(int);
void init_poll();
//void epoll_listener_add(int);
void poll_listener_add(int);
void run(); // main loop
void register_session(MySQL_Session *);
void unregister_session(int);
MySQL_Session * create_new_session_and_client_data_stream(int);
};
#endif /* __CLASS_MYSQL_THREAD_H */