~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Monty Taylor
  • Date: 2009-03-22 07:55:08 UTC
  • mto: (960.5.2 mordred)
  • mto: This revision was merged to the branch mainline in revision 961.
  • Revision ID: mordred@inaugust.com-20090322075508-1h34cksq2knhaxc3
Removed global.h from a header.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
12
 
13
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
 
14
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 
15
Place, Suite 330, Boston, MA 02111-1307 USA
16
16
 
17
17
*****************************************************************************/
18
18
 
19
 
/**************************************************//**
20
 
@file usr/usr0sess.c
 
19
/******************************************************
21
20
Sessions
22
21
 
23
22
Created 6/25/1996 Heikki Tuuri
31
30
 
32
31
#include "trx0trx.h"
33
32
 
34
 
/*********************************************************************//**
35
 
Opens a session.
36
 
@return own: session object */
 
33
/*************************************************************************
 
34
Closes a session, freeing the memory occupied by it. */
 
35
static
 
36
void
 
37
sess_close(
 
38
/*=======*/
 
39
        sess_t*         sess);  /* in, own: session object */
 
40
 
 
41
/*************************************************************************
 
42
Opens a session. */
37
43
UNIV_INTERN
38
44
sess_t*
39
45
sess_open(void)
40
46
/*===========*/
 
47
                                        /* out, own: session object */
41
48
{
42
49
        sess_t* sess;
43
50
 
54
61
        return(sess);
55
62
}
56
63
 
57
 
/*********************************************************************//**
 
64
/*************************************************************************
58
65
Closes a session, freeing the memory occupied by it. */
59
 
UNIV_INTERN
 
66
static
60
67
void
61
68
sess_close(
62
69
/*=======*/
63
 
        sess_t* sess)   /*!< in, own: session object */
 
70
        sess_t* sess)   /* in, own: session object */
64
71
{
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);
 
72
        ut_ad(mutex_own(&kernel_mutex));
 
73
        ut_ad(sess->trx == NULL);
 
74
 
70
75
        mem_free(sess);
71
76
}
 
77
 
 
78
/*************************************************************************
 
79
Closes a session, freeing the memory occupied by it, if it is in a state
 
80
where it should be closed. */
 
81
UNIV_INTERN
 
82
ibool
 
83
sess_try_close(
 
84
/*===========*/
 
85
                        /* out: TRUE if closed */
 
86
        sess_t* sess)   /* in, own: session object */
 
87
{
 
88
        ut_ad(mutex_own(&kernel_mutex));
 
89
 
 
90
        if (UT_LIST_GET_LEN(sess->graphs) == 0) {
 
91
                sess_close(sess);
 
92
 
 
93
                return(TRUE);
 
94
        }
 
95
 
 
96
        return(FALSE);
 
97
}