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 multi_thread {
00027 
00028 class MultiThreadScheduler: public drizzled::plugin::Scheduler
00029 {
00030 private:
00031   drizzled::atomic<uint32_t> thread_count;
00032 
00033 public:
00034   MultiThreadScheduler(const char *name_arg): 
00035     Scheduler(name_arg)
00036   {
00037     setStackSize();
00038     thread_count= 0;
00039   }
00040 
00041   ~MultiThreadScheduler();
00042   bool addSession(const drizzled::Session::shared_ptr&);
00043   void killSessionNow(const drizzled::Session::shared_ptr&);
00044   void killSession(drizzled::Session*);
00045   
00046   void runSession(drizzled::session_id_t);
00047 private:
00048   void setStackSize();
00049 };
00050 
00051 } // namespace multi_thread
00052