~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/scheduler.h

  • Committer: Brian Aker
  • Date: 2008-11-04 15:39:09 UTC
  • mfrom: (575.1.2 devel)
  • Revision ID: brian@tangent.org-20081104153909-c72hn65udxs1ccal
Merge of Monty's work

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 */
 
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
 
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
 
3
 *
 
4
 *  Copyright (C) 2008 Sun Microsystems
 
5
 *
 
6
 *  This program is free software; you can redistribute it and/or modify
 
7
 *  it under the terms of the GNU General Public License as published by
 
8
 *  the Free Software Foundation; version 2 of the License.
 
9
 *
 
10
 *  This program is distributed in the hope that it will be useful,
 
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 *  GNU General Public License for more details.
 
14
 *
 
15
 *  You should have received a copy of the GNU General Public License
 
16
 *  along with this program; if not, write to the Free Software
 
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
18
 */
15
19
 
16
20
#ifndef DRIZZLE_SERVER_SCHEDULER_H
17
21
#define DRIZZLE_SERVER_SCHEDULER_H
21
25
*/
22
26
 
23
27
/* Forward declarations */
24
 
class THD;
 
28
class Session;
25
29
struct event;
26
30
 
27
31
/* Functions used when manipulating threads */
29
33
class scheduler_functions
30
34
{
31
35
public:
32
 
  uint max_threads;
 
36
  uint32_t max_threads;
33
37
  bool (*init)(void);
34
38
  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);
 
39
  void (*add_connection)(Session *session);
 
40
  void (*post_kill_notification)(Session *session);
 
41
  bool (*end_thread)(Session *session, bool cache_thread);
38
42
  void (*end)(void);
39
43
  scheduler_functions();
40
44
};
41
45
 
42
46
enum scheduler_types
43
47
{
44
 
  SCHEDULER_ONE_THREAD_PER_CONNECTION=0,
45
 
  SCHEDULER_NO_THREADS,
46
48
  SCHEDULER_POOL_OF_THREADS
47
49
};
48
50
 
51
53
 
52
54
#define HAVE_POOL_OF_THREADS 1
53
55
 
54
 
class thd_scheduler
 
56
class session_scheduler
55
57
{
56
58
public:
57
59
  bool logged_in;
58
60
  struct event* io_event;
59
61
  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();
 
62
  bool thread_attached;  /* Indicates if Session is attached to the OS thread */
64
63
 
65
 
  thd_scheduler();
66
 
  ~thd_scheduler();
67
 
  bool init(THD* parent_thd);
 
64
  session_scheduler();
 
65
  ~session_scheduler();
 
66
  session_scheduler(const session_scheduler&);
 
67
  void operator=(const session_scheduler&);
 
68
  bool init(Session* parent_session);
68
69
  bool thread_attach();
69
70
  void thread_detach();
70
71
};