~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/myisam/mi_panic.cc

  • Committer: Brian Aker
  • Date: 2010-08-09 18:04:12 UTC
  • mfrom: (1689.3.7 staging)
  • Revision ID: brian@gaz-20100809180412-olurwh51ojllev6p
Merge in heap conversion, and case insensitive patch, and remove need for
M_HASH in session.

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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
16
#include "myisam_priv.h"
17
17
 
31
31
  int error=0;
32
32
  MI_INFO *info;
33
33
 
34
 
  THR_LOCK_myisam.lock();
 
34
  pthread_mutex_lock(&THR_LOCK_myisam);
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
 
      THR_LOCK_myisam.unlock(); /* Not exactly right... */
 
41
      pthread_mutex_unlock(&THR_LOCK_myisam);   /* Not exactly right... */
42
42
      if (mi_close(info))
43
43
        error=errno;
44
 
      THR_LOCK_myisam.lock();
 
44
      pthread_mutex_lock(&THR_LOCK_myisam);
45
45
      break;
46
46
    case HA_PANIC_WRITE:                /* Do this to free databases */
47
47
#ifdef CANT_OPEN_FILES_TWICE
57
57
      {
58
58
        if (flush_io_cache(&info->rec_cache))
59
59
          error=errno;
60
 
        info->rec_cache.reinit_io_cache(internal::READ_CACHE,0, (bool) (info->lock_type != F_UNLCK),1);
 
60
        reinit_io_cache(&info->rec_cache,internal::READ_CACHE,0,
 
61
                       (bool) (info->lock_type != F_UNLCK),1);
61
62
      }
62
63
      if (info->lock_type != F_UNLCK && ! info->was_locked)
63
64
      {
102
103
    }
103
104
    ++it;
104
105
  }
105
 
  THR_LOCK_myisam.unlock();
 
106
  pthread_mutex_unlock(&THR_LOCK_myisam);
106
107
  if (!error)
107
108
    return(0);
108
109
  return(errno=error);