Drizzled Public API Documentation

usr0sess.cc
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 /**************************************************/
26 #include "usr0sess.h"
27 
28 #ifdef UNIV_NONINL
29 #include "usr0sess.ic"
30 #endif
31 
32 #include "trx0trx.h"
33 
34 /*********************************************************************/
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 = static_cast<sess_t *>(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 /*********************************************************************/
59 UNIV_INTERN
60 void
62 /*=======*/
63  sess_t* sess)
64 {
65  ut_ad(!mutex_own(&kernel_mutex));
66 
67  ut_a(UT_LIST_GET_LEN(sess->graphs) == 0);
68 
70  mem_free(sess);
71 }
#define UT_LIST_GET_LEN(BASE)
Definition: ut0lst.h:217
ulint state
Definition: usr0sess.h:57
#define mem_free(PTR)
Definition: mem0mem.h:249
UNIV_INTERN void sess_close(sess_t *sess)
Definition: usr0sess.cc:61
UNIV_INTERN void trx_free_for_background(trx_t *trx)
Definition: trx0trx.cc:363
UNIV_INTERN trx_t * trx_create(sess_t *sess) __attribute__((nonnull))
Definition: trx0trx.cc:90
trx_t * trx
Definition: usr0sess.h:58
#define ut_a(EXPR)
Definition: ut0dbg.h:105
#define ut_ad(EXPR)
Definition: ut0dbg.h:127
#define UT_LIST_INIT(BASE)
Definition: ut0lst.h:84
UNIV_INTERN sess_t * sess_open(void)
Definition: usr0sess.cc:39