From e91bbca5fb080a8d988c156d78c7dc1b1daaad82 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Thu, 8 Dec 2011 19:17:49 +0100 Subject: Initial threadpool implementation for MariaDB 5.5 --- vio/vio.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'vio/vio.c') diff --git a/vio/vio.c b/vio/vio.c index b8bc7bdae08..aa0d2012afa 100644 --- a/vio/vio.c +++ b/vio/vio.c @@ -49,6 +49,25 @@ static my_bool has_no_data(Vio *vio __attribute__((unused))) return FALSE; } +#ifdef _WIN32 +my_bool vio_shared_memory_has_data(Vio *vio) +{ + return (vio->shared_memory_remain > 0); +} + +int vio_shared_memory_shutdown(Vio *vio, int how) +{ + SetEvent(vio->event_conn_closed); + SetEvent(vio->event_server_wrote); + return 0; +} + +int vio_pipe_shutdown(Vio *vio, int how) +{ + return vio_socket_shutdown(vio, how); /* cancels io */ +} +#endif + /* * Helper to fill most of the Vio* with defaults. */ @@ -89,6 +108,7 @@ static void vio_init(Vio* vio, enum enum_vio_type type, vio->poll_read =no_poll_read; vio->is_connected =vio_is_connected_pipe; vio->has_data =has_no_data; + vio->shutdown =vio_pipe_shutdown; vio->timeout=vio_win32_timeout; /* Set default timeout */ @@ -116,7 +136,8 @@ static void vio_init(Vio* vio, enum enum_vio_type type, vio->poll_read =no_poll_read; vio->is_connected =vio_is_connected_shared_memory; - vio->has_data =has_no_data; + vio->has_data =vio_shared_memory_has_data; + vio->shutdown =vio_shared_memory_shutdown; /* Currently, shared memory is on Windows only, hence the below is ok*/ vio->timeout= vio_win32_timeout; @@ -145,6 +166,7 @@ static void vio_init(Vio* vio, enum enum_vio_type type, vio->poll_read =vio_poll_read; vio->is_connected =vio_is_connected; vio->has_data =vio_ssl_has_data; + vio->shutdown =vio_socket_shutdown; DBUG_VOID_RETURN; } #endif /* HAVE_OPENSSL */ @@ -163,6 +185,7 @@ static void vio_init(Vio* vio, enum enum_vio_type type, vio->timeout =vio_timeout; vio->poll_read =vio_poll_read; vio->is_connected =vio_is_connected; + vio->shutdown =vio_socket_shutdown; vio->has_data= (flags & VIO_BUFFERED_READ) ? vio_buff_has_data : has_no_data; DBUG_VOID_RETURN; -- cgit v1.2.1 From 398c935db30f934cd231fb5566a2bce7917a621c Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Tue, 24 Jan 2012 19:18:22 +0100 Subject: further reduce diffs to 5.5, monty review --- vio/vio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vio/vio.c') diff --git a/vio/vio.c b/vio/vio.c index aa0d2012afa..415e3e23768 100644 --- a/vio/vio.c +++ b/vio/vio.c @@ -64,7 +64,7 @@ int vio_shared_memory_shutdown(Vio *vio, int how) int vio_pipe_shutdown(Vio *vio, int how) { - return vio_socket_shutdown(vio, how); /* cancels io */ + return cancel_io(vio->hPipe, vio->thread_id); } #endif -- cgit v1.2.1