~posulliv/drizzle/optimizer-style-cleanup

« back to all changes in this revision

Viewing changes to drizzled/lock.cc

  • Committer: Padraig O'Sullivan
  • Date: 2010-04-17 01:38:47 UTC
  • mfrom: (1237.9.238 bad-staging)
  • Revision ID: osullivan.padraig@gmail.com-20100417013847-ibjioqsfbmf5yg4g
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1048
1048
  session->global_read_lock= 0;
1049
1049
}
1050
1050
 
1051
 
#define must_wait (global_read_lock &&                             \
1052
 
                   (is_not_commit ||                               \
1053
 
                    global_read_lock_blocks_commit))
 
1051
static inline bool must_wait(bool is_not_commit)
 
1052
{
 
1053
  return (global_read_lock &&
 
1054
          (is_not_commit ||
 
1055
          global_read_lock_blocks_commit));
 
1056
}
1054
1057
 
1055
1058
bool wait_if_global_read_lock(Session *session, bool abort_on_refresh,
1056
1059
                              bool is_not_commit)
1066
1069
  safe_mutex_assert_not_owner(&LOCK_open);
1067
1070
 
1068
1071
  (void) pthread_mutex_lock(&LOCK_global_read_lock);
1069
 
  if ((need_exit_cond= must_wait))
 
1072
  if ((need_exit_cond= must_wait(is_not_commit)))
1070
1073
  {
1071
1074
    if (session->global_read_lock)              // This thread had the read locks
1072
1075
    {
1083
1086
    }
1084
1087
    old_message=session->enter_cond(&COND_global_read_lock, &LOCK_global_read_lock,
1085
1088
                                "Waiting for release of readlock");
1086
 
    while (must_wait && ! session->killed &&
 
1089
    while (must_wait(is_not_commit) && ! session->killed &&
1087
1090
           (!abort_on_refresh || session->version == refresh_version))
1088
1091
    {
1089
1092
      (void) pthread_cond_wait(&COND_global_read_lock, &LOCK_global_read_lock);