Drizzled Public API Documentation

hp_panic.cc
00001 /* Copyright (C) 2000-2002 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 #include "heap_priv.h"
00017 
00018 using namespace std;
00019 using namespace drizzled;
00020 
00021   /* if flag == HA_PANIC_CLOSE then all files are removed for more
00022      memory */
00023 
00024 int hp_panic(enum ha_panic_function flag)
00025 {
00026   THR_LOCK_heap.lock();
00027   list<HP_INFO *>::iterator info_it= heap_open_list.begin();
00028   while (info_it != heap_open_list.end())
00029   {
00030     HP_INFO *info= *info_it;
00031     switch (flag) {
00032     case HA_PANIC_CLOSE:
00033       hp_close(info);
00034       break;
00035     default:
00036       break;
00037     }
00038     ++info_it;
00039   }
00040   list<HP_SHARE *>::iterator share_it= heap_share_list.begin();
00041   while (share_it != heap_share_list.end())
00042   {
00043     HP_SHARE *share= *share_it;
00044     switch (flag) {
00045     case HA_PANIC_CLOSE:
00046     {
00047       if (!share->open_count)
00048   hp_free(share);
00049       break;
00050     }
00051     default:
00052       break;
00053     }
00054     ++share_it;
00055   }
00056   THR_LOCK_heap.unlock();
00057   return(0);
00058 } /* hp_panic */