MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
global_threads.h
1 /* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
2 
3  This program is free software; you can redistribute it and/or modify
4  it under the terms of the GNU General Public License as published by
5  the Free Software Foundation; version 2 of the License.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  GNU General Public License for more details.
11 
12  You should have received a copy of the GNU General Public License
13  along with this program; if not, write to the Free Software
14  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
15 
16 #ifndef GLOBAL_THREADS_INCLUDED
17 #define GLOBAL_THREADS_INCLUDED
18 
19 #include <my_global.h>
20 #include <my_pthread.h>
21 #include <set>
22 
23 class THD;
24 
25 extern mysql_mutex_t LOCK_thread_count;
26 extern mysql_cond_t COND_thread_count;
27 
40 typedef std::set<THD*>::iterator Thread_iterator;
41 Thread_iterator global_thread_list_begin();
42 Thread_iterator global_thread_list_end();
43 void add_global_thread(THD *);
44 void remove_global_thread(THD *);
45 
46 /*
47  We maintain a separate counter for the number of threads,
48  which can be accessed without LOCK_thread_count.
49  An un-locked read, means that the result is fuzzy of course.
50  This accessor is used by DBUG printing, by signal handlers,
51  and by the 'mysqladmin status' command.
52 */
53 uint get_thread_count();
54 
55 #endif // GLOBAL_THREADS_INCLUDED