~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/lock.cc

  • Committer: Monty Taylor
  • Date: 2010-09-29 04:27:16 UTC
  • mfrom: (1800.1.9 build)
  • Revision ID: mordred@inaugust.com-20100929042716-q9sb3re31iwti87z
Merged doc fixes, lock fixes, path fixes and bath fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
762
762
}
763
763
 
764
764
 
765
 
bool wait_for_locked_table_names(Session *session, TableList *table_list)
 
765
static bool wait_for_locked_table_names(Session *session, TableList *table_list)
766
766
{
767
767
  bool result= false;
768
768
 
769
 
  safe_mutex_assert_owner(LOCK_open.native_handle());
 
769
#if 0
 
770
  assert(ownership of LOCK_open);
 
771
#endif
770
772
 
771
773
  while (locked_named_table(table_list))
772
774
  {
1012
1014
                                "Waiting to get readlock");
1013
1015
 
1014
1016
    waiting_for_read_lock++;
 
1017
    boost::mutex::scoped_lock scopedLock(LOCK_global_read_lock, boost::adopt_lock_t());
1015
1018
    while (protect_against_global_read_lock && !session->killed)
1016
 
      pthread_cond_wait(COND_global_read_lock.native_handle(), LOCK_global_read_lock.native_handle());
 
1019
      COND_global_read_lock.wait(scopedLock);
1017
1020
    waiting_for_read_lock--;
 
1021
    scopedLock.release();
1018
1022
    if (session->killed)
1019
1023
    {
1020
1024
      session->exit_cond(old_message);
1095
1099
    while (must_wait(is_not_commit) && ! session->killed &&
1096
1100
           (!abort_on_refresh || session->version == refresh_version))
1097
1101
    {
1098
 
      (void) pthread_cond_wait(COND_global_read_lock.native_handle(), LOCK_global_read_lock.native_handle());
 
1102
      boost::mutex::scoped_lock scoped(LOCK_global_read_lock, boost::adopt_lock_t());
 
1103
      COND_global_read_lock.wait(scoped);
 
1104
      scoped.release();
1099
1105
    }
1100
1106
    if (session->killed)
1101
1107
      result=1;
1145
1151
  old_message= session->enter_cond(COND_global_read_lock, LOCK_global_read_lock,
1146
1152
                                   "Waiting for all running commits to finish");
1147
1153
  while (protect_against_global_read_lock && !session->killed)
1148
 
    pthread_cond_wait(COND_global_read_lock.native_handle(), LOCK_global_read_lock.native_handle());
 
1154
  {
 
1155
    boost::mutex::scoped_lock scopedLock(LOCK_global_read_lock, boost::adopt_lock_t());
 
1156
    COND_global_read_lock.wait(scopedLock);
 
1157
    scopedLock.release();
 
1158
  }
1149
1159
  if ((error= test(session->killed)))
1150
1160
    global_read_lock_blocks_commit--; // undo what we did
1151
1161
  else