~ubuntu-branches/ubuntu/wily/mysql-5.6/wily

« back to all changes in this revision

Viewing changes to sql/lock.cc

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2015-07-21 07:09:29 UTC
  • mto: This revision was merged to the branch mainline in revision 14.
  • Revision ID: package-import@ubuntu.com-20150721070929-mg4dpqkgg3it1ajf
Tags: upstream-5.6.25
ImportĀ upstreamĀ versionĀ 5.6.25

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
 
1
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
2
2
 
3
3
   This program is free software; you can redistribute it and/or modify
4
4
   it under the terms of the GNU General Public License as published by
82
82
#include "sql_acl.h"                       // SUPER_ACL
83
83
#include <hash.h>
84
84
#include <assert.h>
85
 
 
 
85
#include "my_atomic.h"
86
86
/**
87
87
  @defgroup Locking Locking
88
88
  @{
895
895
  DBUG_VOID_RETURN;
896
896
}
897
897
 
 
898
volatile int32 Global_read_lock::m_active_requests;
898
899
 
899
900
/****************************************************************************
900
901
  Handling of global read locks
975
976
                                                 MDL_SHARED));
976
977
    mdl_request.init(MDL_key::GLOBAL, "", "", MDL_SHARED, MDL_EXPLICIT);
977
978
 
 
979
    /* Increment static variable first to signal innodb memcached server
 
980
       to release mdl locks held by it */
 
981
    my_atomic_add32(&Global_read_lock::m_active_requests, 1);
978
982
    if (thd->mdl_context.acquire_lock(&mdl_request,
979
983
                                      thd->variables.lock_wait_timeout))
 
984
    {
 
985
      my_atomic_add32(&Global_read_lock::m_active_requests, -1);
980
986
      DBUG_RETURN(1);
 
987
    }
981
988
 
982
989
    m_mdl_global_shared_lock= mdl_request.ticket;
983
990
    m_state= GRL_ACQUIRED;
1016
1023
    m_mdl_blocks_commits_lock= NULL;
1017
1024
  }
1018
1025
  thd->mdl_context.release_lock(m_mdl_global_shared_lock);
 
1026
  my_atomic_add32(&Global_read_lock::m_active_requests, -1);
1019
1027
  m_mdl_global_shared_lock= NULL;
1020
1028
  m_state= GRL_NONE;
1021
 
 
1022
1029
  DBUG_VOID_RETURN;
1023
1030
}
1024
1031