Drizzled Public API Documentation

thread_var.h
00001 /* Copyright (C) 2000 MySQL AB
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 /* Defines to make different thread packages compatible */
00017 
00018 #pragma once
00019 
00020 #include <pthread.h>
00021 #include <boost/thread/condition_variable.hpp>
00022 #include <boost/thread/mutex.hpp>
00023 #include <boost/thread/recursive_mutex.hpp>
00024 #include <boost/thread/shared_mutex.hpp>
00025 #include <boost/thread/thread.hpp>
00026 #include <boost/thread/tss.hpp>
00027 
00028 namespace drizzled {
00029 namespace internal {
00030 
00031 struct st_my_thread_var
00032 {
00033   boost::condition_variable_any suspend;
00034   boost::mutex mutex;
00035   boost::mutex* volatile current_mutex;
00036   boost::condition_variable_any* volatile current_cond;
00037   uint64_t id;
00038   bool volatile abort;
00039   void* opt_info;
00040 
00041   st_my_thread_var(uint64_t id0) :
00042     current_mutex(NULL),
00043     current_cond(NULL),
00044     id(id0),
00045     abort(false),
00046     opt_info(NULL)
00047   { 
00048   }
00049 };
00050 
00051 typedef boost::thread_specific_ptr<st_my_thread_var> thread_local_st;
00052 
00053 thread_local_st& my_thread_var2();
00054 
00055 } /* namespace internal */
00056 } /* namespace drizzled */