~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Brian Aker
  • Date: 2009-10-15 00:22:33 UTC
  • mto: (1183.1.11 merge)
  • mto: This revision was merged to the branch mainline in revision 1198.
  • Revision ID: brian@gaz-20091015002233-fa4ao2mbc67wls91
First pass of information engine. OMG, ponies... is it so much easier to
deal with creating and engine.

The list table iterator though... its ass, needs to go. We should also
abstract out share. Very few engines need a custom one. Just say'in

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
21
 
Sessions
22
 
 
23
 
Created 6/25/1996 Heikki Tuuri
24
 
*******************************************************/
25
 
 
26
 
#include "usr0sess.h"
27
 
 
28
 
#ifdef UNIV_NONINL
29
 
#include "usr0sess.ic"
30
 
#endif
31
 
 
32
 
#include "trx0trx.h"
33
 
 
34
 
/*********************************************************************//**
35
 
Opens a session.
36
 
@return own: session object */
37
 
UNIV_INTERN
38
 
sess_t*
39
 
sess_open(void)
40
 
/*===========*/
41
 
{
42
 
        sess_t* sess;
43
 
 
44
 
        ut_ad(mutex_own(&kernel_mutex));
45
 
 
46
 
        sess = mem_alloc(sizeof(sess_t));
47
 
 
48
 
        sess->state = SESS_ACTIVE;
49
 
 
50
 
        sess->trx = trx_create(sess);
51
 
 
52
 
        UT_LIST_INIT(sess->graphs);
53
 
 
54
 
        return(sess);
55
 
}
56
 
 
57
 
/*********************************************************************//**
58
 
Closes a session, freeing the memory occupied by it. */
59
 
UNIV_INTERN
60
 
void
61
 
sess_close(
62
 
/*=======*/
63
 
        sess_t* sess)   /*!< in, own: session object */
64
 
{
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);
70
 
        mem_free(sess);
71
 
}