~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/mi_panic.cc

  • Committer: Padraig O'Sullivan
  • Date: 2009-03-28 06:09:15 UTC
  • mto: (968.2.5 mordred)
  • mto: This revision was merged to the branch mainline in revision 971.
  • Revision ID: osullivan.padraig@gmail.com-20090328060915-46xg06g2lavjmbhn
Refactoring MyISAM storage engine again based on LIST replacement with
std::list.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
#include "myisamdef.h"
17
17
 
 
18
using namespace std;
 
19
 
18
20
        /* if flag == HA_PANIC_CLOSE then all misam files are closed */
19
21
        /* if flag == HA_PANIC_WRITE then all misam files are unlocked and
20
22
           all changed data in single user misam is written to file */
26
28
int mi_panic(enum ha_panic_function flag)
27
29
{
28
30
  int error=0;
29
 
  LIST *list_element,*next_open;
30
31
  MI_INFO *info;
31
32
 
32
33
  pthread_mutex_lock(&THR_LOCK_myisam);
33
 
  for (list_element=myisam_open_list ; list_element ; list_element=next_open)
 
34
  list<MI_INFO *>::iterator it= myisam_open_list.begin();
 
35
  while (it != myisam_open_list.end())
34
36
  {
35
 
    next_open=list_element->next;               /* Save if close */
36
 
    info=(MI_INFO*) list_element->data;
 
37
    info= *it;
37
38
    switch (flag) {
38
39
    case HA_PANIC_CLOSE:
39
40
      pthread_mutex_unlock(&THR_LOCK_myisam);   /* Not exactly right... */
99
100
      }
100
101
      break;
101
102
    }
 
103
    ++it;
102
104
  }
103
105
  pthread_mutex_unlock(&THR_LOCK_myisam);
104
106
  if (!error)