~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/heap/hp_panic.c

Renamed more stuff to drizzle.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
   along with this program; if not, write to the Free Software
14
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
 
#include "heap_priv.h"
17
 
 
18
 
using namespace std;
19
 
using namespace drizzled;
 
16
#include "heapdef.h"
20
17
 
21
18
        /* if flag == HA_PANIC_CLOSE then all files are removed for more
22
19
           memory */
23
20
 
24
21
int hp_panic(enum ha_panic_function flag)
25
22
{
26
 
  THR_LOCK_heap.lock();
27
 
  list<HP_INFO *>::iterator info_it= heap_open_list.begin();
28
 
  while (info_it != heap_open_list.end())
 
23
  LIST *element,*next_open;
 
24
  DBUG_ENTER("hp_panic");
 
25
 
 
26
  pthread_mutex_lock(&THR_LOCK_heap);
 
27
  for (element=heap_open_list ; element ; element=next_open)
29
28
  {
30
 
    HP_INFO *info= *info_it;
 
29
    HP_INFO *info=(HP_INFO*) element->data;
 
30
    next_open=element->next;    /* Save if close */
31
31
    switch (flag) {
32
32
    case HA_PANIC_CLOSE:
33
33
      hp_close(info);
35
35
    default:
36
36
      break;
37
37
    }
38
 
    ++info_it;
39
38
  }
40
 
  list<HP_SHARE *>::iterator share_it= heap_share_list.begin();
41
 
  while (share_it != heap_share_list.end())
 
39
  for (element=heap_share_list ; element ; element=next_open)
42
40
  {
43
 
    HP_SHARE *share= *share_it;
 
41
    HP_SHARE *share=(HP_SHARE*) element->data;
 
42
    next_open=element->next;    /* Save if close */
44
43
    switch (flag) {
45
44
    case HA_PANIC_CLOSE:
46
45
    {
51
50
    default:
52
51
      break;
53
52
    }
54
 
    ++share_it;
55
53
  }
56
 
  THR_LOCK_heap.unlock();
57
 
  return(0);
 
54
  pthread_mutex_unlock(&THR_LOCK_heap);
 
55
  DBUG_RETURN(0);
58
56
} /* hp_panic */