MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
usr0sess.cc
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (c) 1996, 2011, Oracle and/or its affiliates. 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.,
15 51 Franklin Street, Suite 500, Boston, MA 02110-1335 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  sess = static_cast<sess_t*>(mem_zalloc(sizeof(*sess)));
45 
46  sess->state = SESS_ACTIVE;
47 
49  sess->trx->sess = sess;
50 
51  UT_LIST_INIT(sess->graphs);
52 
53  return(sess);
54 }
55 
56 /*********************************************************************/
58 UNIV_INTERN
59 void
61 /*=======*/
62  sess_t* sess)
63 {
64  ut_a(UT_LIST_GET_LEN(sess->graphs) == 0);
65 
67  mem_free(sess);
68 }