~drizzle-trunk/drizzle/development

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
1802.10.2 by Monty Taylor
Update all of the copyright headers to include the correct address.
14
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
1 by brian
clean slate
15
1130.3.28 by Monty Taylor
Moved heapdef.h and myisamdef.h to *_priv.h for easier filtering for include guard check.
16
#include "heap_priv.h"
1 by brian
clean slate
17
916.1.26 by Padraig O'Sullivan
Initial work on removing LIST from the heap storage engine.
18
using namespace std;
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
19
using namespace drizzled;
916.1.26 by Padraig O'Sullivan
Initial work on removing LIST from the heap storage engine.
20
1 by brian
clean slate
21
	/* if flag == HA_PANIC_CLOSE then all files are removed for more
22
	   memory */
23
24
int hp_panic(enum ha_panic_function flag)
25
{
1689.3.6 by Brian Aker
Update for HEAP to convert its lock to boost.
26
  THR_LOCK_heap.lock();
916.1.26 by Padraig O'Sullivan
Initial work on removing LIST from the heap storage engine.
27
  list<HP_INFO *>::iterator info_it= heap_open_list.begin();
28
  while (info_it != heap_open_list.end())
1 by brian
clean slate
29
  {
916.1.26 by Padraig O'Sullivan
Initial work on removing LIST from the heap storage engine.
30
    HP_INFO *info= *info_it;
1 by brian
clean slate
31
    switch (flag) {
32
    case HA_PANIC_CLOSE:
33
      hp_close(info);
34
      break;
35
    default:
36
      break;
37
    }
916.1.26 by Padraig O'Sullivan
Initial work on removing LIST from the heap storage engine.
38
    ++info_it;
1 by brian
clean slate
39
  }
916.1.26 by Padraig O'Sullivan
Initial work on removing LIST from the heap storage engine.
40
  list<HP_SHARE *>::iterator share_it= heap_share_list.begin();
41
  while (share_it != heap_share_list.end())
1 by brian
clean slate
42
  {
916.1.26 by Padraig O'Sullivan
Initial work on removing LIST from the heap storage engine.
43
    HP_SHARE *share= *share_it;
1 by brian
clean slate
44
    switch (flag) {
45
    case HA_PANIC_CLOSE:
46
    {
47
      if (!share->open_count)
48
	hp_free(share);
49
      break;
50
    }
51
    default:
52
      break;
53
    }
916.1.26 by Padraig O'Sullivan
Initial work on removing LIST from the heap storage engine.
54
    ++share_it;
1 by brian
clean slate
55
  }
1689.3.6 by Brian Aker
Update for HEAP to convert its lock to boost.
56
  THR_LOCK_heap.unlock();
51.3.1 by Jay Pipes
Removed all DBUG symbols from heap storage engine
57
  return(0);
1 by brian
clean slate
58
} /* hp_panic */