My Project
global_threads.h
00001 /* Copyright (c) 2012, 2014 Oracle and/or its affiliates. All rights reserved.
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 #ifndef GLOBAL_THREADS_INCLUDED
00017 #define GLOBAL_THREADS_INCLUDED
00018 
00019 #include <my_global.h>
00020 #include <my_pthread.h>
00021 #include <set>
00022 
00023 class THD;
00024 
00025 extern mysql_mutex_t LOCK_thread_count;
00026 extern mysql_mutex_t LOCK_thd_remove;
00027 extern mysql_cond_t COND_thread_count;
00028 
00055 typedef std::set<THD*>::iterator Thread_iterator;
00056 Thread_iterator global_thread_list_begin();
00057 Thread_iterator global_thread_list_end();
00058 void copy_global_thread_list(std::set<THD*> *new_copy);
00059 void add_global_thread(THD *);
00060 void remove_global_thread(THD *);
00061 
00062 /*
00063   We maintain a separate counter for the number of threads,
00064   which can be accessed without LOCK_thread_count.
00065   An un-locked read, means that the result is fuzzy of course.
00066   This accessor is used by DBUG printing, by signal handlers,
00067   and by the 'mysqladmin status' command.
00068 */
00069 uint get_thread_count();
00070 
00071 #endif  // GLOBAL_THREADS_INCLUDED
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines