~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/lock/lock0lock.c

  • Committer: Jay Pipes
  • Date: 2009-02-04 15:44:25 UTC
  • mfrom: (829 drizzle)
  • mto: This revision was merged to the branch mainline in revision 830.
  • Revision ID: jpipes@serialcoder-20090204154425-th8xfk2ujz2y8xwg
Merge with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****************************************************************************
2
 
 
3
 
Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
4
 
 
5
 
This program is free software; you can redistribute it and/or modify it under
6
 
the terms of the GNU General Public License as published by the Free Software
7
 
Foundation; version 2 of the License.
8
 
 
9
 
This program is distributed in the hope that it will be useful, but WITHOUT
10
 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
 
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
 
 
13
 
You should have received a copy of the GNU General Public License along with
14
 
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15
 
Place, Suite 330, Boston, MA 02111-1307 USA
16
 
 
17
 
*****************************************************************************/
18
 
 
19
1
/******************************************************
20
2
The transaction lock system
21
3
 
 
4
(c) 1996 Innobase Oy
 
5
 
22
6
Created 5/7/1996 Heikki Tuuri
23
7
*******************************************************/
24
8
 
715
699
        const lock_t*   lock;
716
700
        ibool           ok      = FALSE;
717
701
 
718
 
        ut_ad(table);
719
 
        ut_ad(trx);
720
 
 
721
 
        lock_mutex_enter_kernel();
 
702
        ut_ad(table && trx);
722
703
 
723
704
        for (lock = UT_LIST_GET_FIRST(table->locks);
724
705
             lock;
726
707
                if (lock->trx != trx) {
727
708
                        /* A lock on the table is held
728
709
                        by some other transaction. */
729
 
                        goto not_ok;
 
710
                        return(FALSE);
730
711
                }
731
712
 
732
713
                if (!(lock_get_type_low(lock) & LOCK_TABLE)) {
743
724
                        auto_increment lock. */
744
725
                        break;
745
726
                default:
746
 
not_ok:
747
727
                        /* Other table locks than LOCK_IX are not allowed. */
748
 
                        ok = FALSE;
749
 
                        goto func_exit;
 
728
                        return(FALSE);
750
729
                }
751
730
        }
752
731
 
753
 
func_exit:
754
 
        lock_mutex_exit_kernel();
755
 
 
756
732
        return(ok);
757
733
}
758
734
 
3858
3834
        dict_table_t*   table;
3859
3835
        lock_t*         lock;
3860
3836
 
3861
 
        ut_ad(mutex_own(&kernel_mutex));
3862
3837
        ut_ad(lock_get_wait(wait_lock));
3863
3838
 
3864
3839
        table = wait_lock->un_member.tab_lock.table;