1
by brian
clean slate |
1 |
/* Copyright (C) 2000-2002 MySQL AB
|
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
15 |
||
16 |
#include "heapdef.h" |
|
17 |
||
916.1.26
by Padraig O'Sullivan
Initial work on removing LIST from the heap storage engine. |
18 |
using namespace std; |
19 |
||
1
by brian
clean slate |
20 |
/* if flag == HA_PANIC_CLOSE then all files are removed for more
|
21 |
memory */
|
|
22 |
||
23 |
int hp_panic(enum ha_panic_function flag) |
|
24 |
{
|
|
25 |
pthread_mutex_lock(&THR_LOCK_heap); |
|
916.1.26
by Padraig O'Sullivan
Initial work on removing LIST from the heap storage engine. |
26 |
list<HP_INFO *>::iterator info_it= heap_open_list.begin(); |
27 |
while (info_it != heap_open_list.end()) |
|
1
by brian
clean slate |
28 |
{
|
916.1.26
by Padraig O'Sullivan
Initial work on removing LIST from the heap storage engine. |
29 |
HP_INFO *info= *info_it; |
1
by brian
clean slate |
30 |
switch (flag) { |
31 |
case HA_PANIC_CLOSE: |
|
32 |
hp_close(info); |
|
33 |
break; |
|
34 |
default: |
|
35 |
break; |
|
36 |
}
|
|
916.1.26
by Padraig O'Sullivan
Initial work on removing LIST from the heap storage engine. |
37 |
++info_it; |
1
by brian
clean slate |
38 |
}
|
916.1.26
by Padraig O'Sullivan
Initial work on removing LIST from the heap storage engine. |
39 |
list<HP_SHARE *>::iterator share_it= heap_share_list.begin(); |
40 |
while (share_it != heap_share_list.end()) |
|
1
by brian
clean slate |
41 |
{
|
916.1.26
by Padraig O'Sullivan
Initial work on removing LIST from the heap storage engine. |
42 |
HP_SHARE *share= *share_it; |
1
by brian
clean slate |
43 |
switch (flag) { |
44 |
case HA_PANIC_CLOSE: |
|
45 |
{
|
|
46 |
if (!share->open_count) |
|
47 |
hp_free(share); |
|
48 |
break; |
|
49 |
}
|
|
50 |
default: |
|
51 |
break; |
|
52 |
}
|
|
916.1.26
by Padraig O'Sullivan
Initial work on removing LIST from the heap storage engine. |
53 |
++share_it; |
1
by brian
clean slate |
54 |
}
|
55 |
pthread_mutex_unlock(&THR_LOCK_heap); |
|
51.3.1
by Jay Pipes
Removed all DBUG symbols from heap storage engine |
56 |
return(0); |
1
by brian
clean slate |
57 |
} /* hp_panic */ |