~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/myisam/mi_panic.cc

  • Committer: Stewart Smith
  • Date: 2010-11-03 03:27:09 UTC
  • mto: (1902.1.1 build) (1910.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1903.
  • Revision ID: stewart@flamingspork.com-20101103032709-oyvfrc6eb8fzj0mr
fix docs warning: docs/unlock.rst:2: (WARNING/2) Title underline too short.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
14
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
15
15
 
16
16
#include "myisam_priv.h"
17
17
 
31
31
  int error=0;
32
32
  MI_INFO *info;
33
33
 
34
 
  pthread_mutex_lock(&THR_LOCK_myisam);
 
34
  THR_LOCK_myisam.lock();
35
35
  list<MI_INFO *>::iterator it= myisam_open_list.begin();
36
36
  while (it != myisam_open_list.end())
37
37
  {
38
38
    info= *it;
39
39
    switch (flag) {
40
40
    case HA_PANIC_CLOSE:
41
 
      pthread_mutex_unlock(&THR_LOCK_myisam);   /* Not exactly right... */
 
41
      THR_LOCK_myisam.unlock(); /* Not exactly right... */
42
42
      if (mi_close(info))
43
43
        error=errno;
44
 
      pthread_mutex_lock(&THR_LOCK_myisam);
 
44
      THR_LOCK_myisam.lock();
45
45
      break;
46
46
    case HA_PANIC_WRITE:                /* Do this to free databases */
47
47
#ifdef CANT_OPEN_FILES_TWICE
48
48
      if (info->s->options & HA_OPTION_READ_ONLY_DATA)
49
49
        break;
50
50
#endif
51
 
      if (flush_key_blocks(info->s->key_cache, info->s->kfile, FLUSH_RELEASE))
 
51
      if (flush_key_blocks(info->s->getKeyCache(), info->s->kfile, FLUSH_RELEASE))
52
52
        error=errno;
53
53
      if (info->opt_flag & WRITE_CACHE_USED)
54
54
        if (flush_io_cache(&info->rec_cache))
103
103
    }
104
104
    ++it;
105
105
  }
106
 
  pthread_mutex_unlock(&THR_LOCK_myisam);
 
106
  THR_LOCK_myisam.unlock();
107
107
  if (!error)
108
108
    return(0);
109
109
  return(errno=error);