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_dummy(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 hold!
40
void handle_connection_in_main_thread(Session *session)
42
safe_mutex_assert_owner(&LOCK_thread_count);
43
(void) pthread_mutex_unlock(&LOCK_thread_count);
44
handle_one_connection((void*) session);
49
End connection, in case when we are using 'no-threads'
52
static bool end_thread(Session *, bool)
54
pthread_mutex_unlock(&LOCK_thread_count);
55
return true; // Abort handle_one_connection
58
static int init(void *p)
60
scheduler_functions* func= (scheduler_functions *)p;
63
func->add_connection= handle_connection_in_main_thread;
64
func->init_new_connection_thread= init_dummy;
65
func->end_thread= end_thread;
70
static int deinit(void *)
75
mysql_declare_plugin(single_thread)
77
DRIZZLE_SCHEDULING_PLUGIN,
81
"Single Thread Scheduler",
83
init, /* Plugin Init */
84
deinit, /* Plugin Deinit */
85
NULL, /* status variables */
86
NULL, /* system variables */
87
NULL /* config options */
89
mysql_declare_plugin_end;