~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/usr/usr0sess.c

  • Committer: Jay Pipes
  • Date: 2009-03-13 23:35:46 UTC
  • mto: This revision was merged to the branch mainline in revision 937.
  • Revision ID: jpipes@serialcoder-20090313233546-n12t6xpf71um75fo
Split index hints out into their own file, removal from sql_lex.h and sql_select.cc

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., 51 Franklin
15
 
St, Fifth Floor, Boston, MA 02110-1301 USA
16
 
 
17
 
*****************************************************************************/
18
 
 
19
 
/**************************************************//**
20
 
@file usr/usr0sess.c
 
1
/******************************************************
21
2
Sessions
22
3
 
 
4
(c) 1996 Innobase Oy
 
5
 
23
6
Created 6/25/1996 Heikki Tuuri
24
7
*******************************************************/
25
8
 
31
14
 
32
15
#include "trx0trx.h"
33
16
 
34
 
/*********************************************************************//**
35
 
Opens a session.
36
 
@return own: session object */
 
17
/*************************************************************************
 
18
Closes a session, freeing the memory occupied by it. */
 
19
static
 
20
void
 
21
sess_close(
 
22
/*=======*/
 
23
        sess_t*         sess);  /* in, own: session object */
 
24
 
 
25
/*************************************************************************
 
26
Opens a session. */
37
27
UNIV_INTERN
38
28
sess_t*
39
29
sess_open(void)
40
30
/*===========*/
 
31
                                        /* out, own: session object */
41
32
{
42
33
        sess_t* sess;
43
34
 
54
45
        return(sess);
55
46
}
56
47
 
57
 
/*********************************************************************//**
 
48
/*************************************************************************
58
49
Closes a session, freeing the memory occupied by it. */
59
 
UNIV_INTERN
 
50
static
60
51
void
61
52
sess_close(
62
53
/*=======*/
63
 
        sess_t* sess)   /*!< in, own: session object */
 
54
        sess_t* sess)   /* in, own: session object */
64
55
{
65
 
        ut_ad(!mutex_own(&kernel_mutex));
66
 
 
67
 
        ut_a(UT_LIST_GET_LEN(sess->graphs) == 0);
68
 
 
69
 
        trx_free_for_background(sess->trx);
 
56
        ut_ad(mutex_own(&kernel_mutex));
 
57
        ut_ad(sess->trx == NULL);
 
58
 
70
59
        mem_free(sess);
71
60
}
 
61
 
 
62
/*************************************************************************
 
63
Closes a session, freeing the memory occupied by it, if it is in a state
 
64
where it should be closed. */
 
65
UNIV_INTERN
 
66
ibool
 
67
sess_try_close(
 
68
/*===========*/
 
69
                        /* out: TRUE if closed */
 
70
        sess_t* sess)   /* in, own: session object */
 
71
{
 
72
        ut_ad(mutex_own(&kernel_mutex));
 
73
 
 
74
        if (UT_LIST_GET_LEN(sess->graphs) == 0) {
 
75
                sess_close(sess);
 
76
 
 
77
                return(TRUE);
 
78
        }
 
79
 
 
80
        return(FALSE);
 
81
}