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/recursive_mutex.hpp>
00022 #include <boost/thread/mutex.hpp>
00023 #include <boost/thread/shared_mutex.hpp>
00024 #include <boost/thread/condition_variable.hpp>
00025 
00026 namespace drizzled
00027 {
00028 namespace internal
00029 {
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   int volatile abort;
00039   void *opt_info;
00040 
00041   st_my_thread_var() :
00042     current_mutex(0),
00043     current_cond(0),
00044     id(0),
00045     abort(false),
00046     opt_info(0)
00047   { 
00048   }
00049 
00050   ~st_my_thread_var()
00051   {
00052   }
00053 };
00054 
00055 extern struct st_my_thread_var *_my_thread_var(void);
00056 #define my_thread_var (::drizzled::internal::_my_thread_var())
00057 
00058 } /* namespace internal */
00059 } /* namespace drizzled */
00060