~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/scheduler.h

pandora-build v0.71. Added check for avahi.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2007 MySQL AB
2
 
 
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.
6
 
 
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.
11
 
 
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
 
 
16
 
#ifndef DRIZZLE_SERVER_SCHEDULER_H
17
 
#define DRIZZLE_SERVER_SCHEDULER_H
18
 
 
19
 
/*
20
 
  Classes for the thread scheduler
21
 
*/
22
 
 
23
 
/* Forward declarations */
24
 
class THD;
25
 
struct event;
26
 
 
27
 
/* Functions used when manipulating threads */
28
 
 
29
 
class scheduler_functions
30
 
{
31
 
public:
32
 
  uint max_threads;
33
 
  bool (*init)(void);
34
 
  bool (*init_new_connection_thread)(void);
35
 
  void (*add_connection)(THD *thd);
36
 
  void (*post_kill_notification)(THD *thd);
37
 
  bool (*end_thread)(THD *thd, bool cache_thread);
38
 
  void (*end)(void);
39
 
  scheduler_functions();
40
 
};
41
 
 
42
 
enum scheduler_types
43
 
{
44
 
  SCHEDULER_ONE_THREAD_PER_CONNECTION=0,
45
 
  SCHEDULER_NO_THREADS,
46
 
  SCHEDULER_POOL_OF_THREADS
47
 
};
48
 
 
49
 
void one_thread_per_connection_scheduler(scheduler_functions* func);
50
 
void one_thread_scheduler(scheduler_functions* func);
51
 
 
52
 
#define HAVE_POOL_OF_THREADS 1
53
 
 
54
 
class thd_scheduler
55
 
{
56
 
public:
57
 
  bool logged_in;
58
 
  struct event* io_event;
59
 
  LIST list;
60
 
  bool thread_attached;  /* Indicates if THD is attached to the OS thread */
61
 
  
62
 
  char dbug_explain_buf[256];
63
 
  void swap_dbug_explain();
64
 
 
65
 
  thd_scheduler();
66
 
  ~thd_scheduler();
67
 
  bool init(THD* parent_thd);
68
 
  bool thread_attach();
69
 
  void thread_detach();
70
 
};
71
 
 
72
 
void pool_of_threads_scheduler(scheduler_functions* func);
73
 
 
74
 
#endif /* DRIZZLE_SERVER_SCHEDULER_H */