1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Replace the approach using Foo_thread_args + Foo_thread and manually

spawned threads with a reusable class Thread.

This is the second idea implemented in the Alik's patch for
BUG#22306: STOP INSTANCE can not be applied for instances in Crashed,
Failed and Abandoned.
Commiting separately to ease review process.
This commit is contained in:
kostja@bodhi.local
2006-11-17 16:11:04 +03:00
parent 2f69dfb28f
commit 7278f45bfd
13 changed files with 337 additions and 421 deletions

View File

@ -16,33 +16,39 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <my_global.h>
#include <my_pthread.h>
#include "thread_registry.h"
#if defined(__GNUC__) && defined(USE_PRAGMA_INTERFACE)
#pragma interface
#endif
pthread_handler_t listener(void *arg);
class Thread_registry;
class User_map;
class Instance_map;
struct Listener_thread_args
/**
Listener - a thread listening on sockets and spawning
connection threads.
*/
class Listener: public Thread
{
Thread_registry &thread_registry;
const User_map &user_map;
Instance_map &instance_map;
public:
Listener(Thread_registry *thread_registry_arg, User_map *user_map_arg);
protected:
virtual void run();
private:
Thread_info thread_info;
Thread_registry *thread_registry;
User_map *user_map;
static const int LISTEN_BACK_LOG_SIZE= 5; /* standard backlog size */
ulong total_connection_count;
Listener_thread_args(Thread_registry &thread_registry_arg,
const User_map &user_map_arg,
Instance_map &instance_map_arg) :
thread_registry(thread_registry_arg)
,user_map(user_map_arg)
,instance_map(instance_map_arg)
{}
int sockets[2];
int num_sockets;
fd_set read_fds;
void handle_new_mysql_connection(struct st_vio *vio);
int create_tcp_socket();
int create_unix_socket(struct sockaddr_un &unix_socket_address);
};
#endif // INCLUDES_MYSQL_INSTANCE_MANAGER_LISTENER_H