Drizzled Public API Documentation

multi_thread.h
00001 /* Copyright (C) 2009 Sun Microsystems, Inc.
00002 
00003   This program is free software; you can redistribute it and/or modify
00004   it under the terms of the GNU General Public License as published by
00005   the Free Software Foundation; version 2 of the License.
00006 
00007   This program is distributed in the hope that it will be useful,
00008   but WITHOUT ANY WARRANTY; without even the implied warranty of
00009   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010   GNU General Public License for more details.
00011 
00012   You should have received a copy of the GNU General Public License
00013   along with this program; if not, write to the Free Software
00014   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
00015 
00016 #pragma once
00017 
00018 #include <drizzled/atomics.h>
00019 #include <drizzled/gettext.h>
00020 #include <drizzled/error.h>
00021 #include <drizzled/plugin/scheduler.h>
00022 #include <drizzled/internal/my_sys.h>
00023 #include <drizzled/sql_parse.h>
00024 #include <string>
00025 
00026 namespace drizzled {
00027 class Session;
00028 }
00029 
00030 namespace multi_thread {
00031 
00032 class MultiThreadScheduler: public drizzled::plugin::Scheduler
00033 {
00034 private:
00035   drizzled::atomic<uint32_t> thread_count;
00036 
00037 public:
00038   MultiThreadScheduler(const char *name_arg): 
00039     Scheduler(name_arg)
00040   {
00041     setStackSize();
00042     thread_count= 0;
00043   }
00044 
00045   ~MultiThreadScheduler();
00046   bool addSession(drizzled::Session::shared_ptr &session);
00047   void killSessionNow(drizzled::Session::shared_ptr &session);
00048   void killSession(drizzled::Session*);
00049   
00050   void runSession(drizzled::session_id_t);
00051 private:
00052   void setStackSize();
00053 };
00054 
00055 } // namespace multi_thread
00056