~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/heap/hp_panic.cc

Merged padraig's removal of list.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
#include "heapdef.h"
17
17
 
 
18
using namespace std;
 
19
 
18
20
        /* if flag == HA_PANIC_CLOSE then all files are removed for more
19
21
           memory */
20
22
 
21
23
int hp_panic(enum ha_panic_function flag)
22
24
{
23
 
  LIST *element,*next_open;
24
 
 
25
25
  pthread_mutex_lock(&THR_LOCK_heap);
26
 
  for (element=heap_open_list ; element ; element=next_open)
 
26
  list<HP_INFO *>::iterator info_it= heap_open_list.begin();
 
27
  while (info_it != heap_open_list.end())
27
28
  {
28
 
    HP_INFO *info=(HP_INFO*) element->data;
29
 
    next_open=element->next;    /* Save if close */
 
29
    HP_INFO *info= *info_it;
30
30
    switch (flag) {
31
31
    case HA_PANIC_CLOSE:
32
32
      hp_close(info);
34
34
    default:
35
35
      break;
36
36
    }
 
37
    ++info_it;
37
38
  }
38
 
  for (element=heap_share_list ; element ; element=next_open)
 
39
  list<HP_SHARE *>::iterator share_it= heap_share_list.begin();
 
40
  while (share_it != heap_share_list.end())
39
41
  {
40
 
    HP_SHARE *share=(HP_SHARE*) element->data;
41
 
    next_open=element->next;    /* Save if close */
 
42
    HP_SHARE *share= *share_it;
42
43
    switch (flag) {
43
44
    case HA_PANIC_CLOSE:
44
45
    {
49
50
    default:
50
51
      break;
51
52
    }
 
53
    ++share_it;
52
54
  }
53
55
  pthread_mutex_unlock(&THR_LOCK_heap);
54
56
  return(0);