~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin_scheduling.h

  • Committer: Monty Taylor
  • Date: 2009-03-04 02:48:12 UTC
  • mto: (917.1.2 mordred)
  • mto: This revision was merged to the branch mainline in revision 918.
  • Revision ID: mordred@inaugust.com-20090304024812-5wb6wpye5c1iitbq
Applied atomic patch to current tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
 
1
/*
 
2
 -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
3
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 
 *
 
4
 
4
5
 *  Definitions required for Configuration Variables plugin
5
 
 *
6
 
 *  Copyright (C) 2008 Sun Microsystems
 
6
 
 
7
 *  Copyright (C) 2008 Mark Atwood
7
8
 *
8
9
 *  This program is free software; you can redistribute it and/or modify
9
10
 *  it under the terms of the GNU General Public License as published by
19
20
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20
21
 */
21
22
 
22
 
#ifndef DRIZZLED_PLUGIN_SCHEDULER_H
23
 
#define DRIZZLED_PLUGIN_SCHEDULER_H
24
 
 
25
 
#include "drizzled/session.h"
26
 
#include "drizzled/plugin/plugin.h"
27
 
 
28
 
#include <string>
29
 
#include <vector>
30
 
 
31
 
namespace drizzled
32
 
{
33
 
 
34
 
class Session;
35
 
 
36
 
namespace plugin
37
 
{
38
 
 
39
 
/**
40
 
 * This class should be used by scheduler plugins to implement custom session
41
 
 * schedulers.
42
 
 */
43
 
class Scheduler : public Plugin
44
 
{
45
 
  /* Disable default constructors */
46
 
  Scheduler();
47
 
  Scheduler(const Scheduler &);
48
 
  Scheduler& operator=(const Scheduler &);
49
 
public:
50
 
  explicit Scheduler(std::string name_arg)
51
 
    : Plugin(name_arg, "Scheduler")
52
 
  {}
53
 
  virtual ~Scheduler() {}
54
 
 
55
 
  /**
56
 
   * Add a session to the scheduler. When the scheduler is ready to run the
57
 
   * session, it should call session->run().
58
 
   */
59
 
  virtual bool addSession(Session::shared_ptr &session)= 0;
60
 
 
61
 
  /**
62
 
   * Notify the scheduler that it should be killed gracefully.
63
 
   */
64
 
  virtual void killSession(Session *) {}
65
 
 
66
 
  /**
67
 
   * This is called when a scheduler should kill the session immedaitely.
68
 
   */
69
 
  virtual void killSessionNow(Session::shared_ptr&) {}
70
 
 
71
 
  static bool addPlugin(plugin::Scheduler *sced);
72
 
  static void removePlugin(plugin::Scheduler *sced);
73
 
  static bool setPlugin(const std::string& name);
74
 
  static Scheduler *getScheduler();
75
 
};
76
 
 
77
 
} /* namespace plugin */
78
 
} /* namespace drizzled */
79
 
 
80
 
#endif /* DRIZZLED_PLUGIN_SCHEDULER_H */
 
23
#ifndef DRIZZLED_PLUGIN_SCHEDULING_H
 
24
#define DRIZZLED_PLUGIN_SCHEDULING_H
 
25
 
 
26
typedef struct scheduling_st
 
27
{
 
28
  uint32_t max_threads;
 
29
  bool (*init_new_connection_thread)(void);
 
30
  bool (*add_connection)(Session *session);
 
31
  void (*post_kill_notification)(Session *session);
 
32
  bool (*end_thread)(Session *session, bool cache_thread);
 
33
} scheduling_st;
 
34
 
 
35
#endif /* DRIZZLED_PLUGIN_SCHEDULING_H */