1
/* Copyright (C) 2006 MySQL AB
3
This program is free software; you can redistribute it and/or modify
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation; version 2 of the License.
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
12
You should have received a copy of the GNU General Public License
13
along with this program; if not, write to the Free Software
14
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
16
#include <drizzled/server_includes.h>
17
#include <drizzled/gettext.h>
18
#include <drizzled/error.h>
19
#include <drizzled/plugin_scheduling.h>
20
#include <drizzled/serialize/serialize.h>
21
#include <drizzled/connect.h>
22
#include <drizzled/sql_parse.h>
23
#include <drizzled/session.h>
24
#include <drizzled/connect.h>
28
static bool init_new_connection_thread(void) {return 0;}
31
Simple scheduler that use the main thread to handle the request
34
This is only used for debugging, when starting mysqld with
35
--thread-handling=no-threads or --one-thread
37
When we enter this function, LOCK_thread_count is held!
40
bool add_connection(Session *session)
42
safe_mutex_assert_owner(&LOCK_thread_count);
43
(void) pthread_mutex_unlock(&LOCK_thread_count);
44
handle_one_connection((void*) session);
51
End connection, in case when we are using 'no-threads'
54
static bool end_thread(Session *session, bool)
56
unlink_session(session); /* locks LOCK_thread_count and deletes session */
58
return true; // Abort handle_one_connection
61
static int init(void *p)
63
scheduling_st* func= (scheduling_st *)p;
66
func->add_connection= add_connection;
67
func->init_new_connection_thread= init_new_connection_thread;
68
func->end_thread= end_thread;
73
static int deinit(void *)
78
static struct st_mysql_sys_var* system_variables[]= {
82
drizzle_declare_plugin(single_thread)
84
DRIZZLE_SCHEDULING_PLUGIN,
88
"Single Thread Scheduler",
90
init, /* Plugin Init */
91
deinit, /* Plugin Deinit */
92
NULL, /* status variables */
93
system_variables, /* system variables */
94
NULL /* config options */
96
drizzle_declare_plugin_end;