~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Mats Kindahl
  • Date: 2008-08-26 07:32:59 UTC
  • mto: (489.1.2 codestyle)
  • mto: This revision was merged to the branch mainline in revision 491.
  • Revision ID: mats@mysql.com-20080826073259-9k4evtajgldgolli
Replaced use of thd_proc_info() macro with calls to
set_proc_info() and get_proc_info() internally.  Introduced
functions set_thd_proc_info() and get_thd_proc_info() for
external users, i.e., plug-ins.

The set_thd_proc_info() accepted callers info that can be used to
print debug output, but the information was not used. The return
value was changed to void and the old value is not fetched any
more. To be able to get the value of proc_info for external
users, the function get_thd_proc_info() was introduced.

The thd_proc_info() macro called set_thd_proc_info() but almost
never used the return value of set_thd_proc_info() so the macro
was replaced with a call of THD::set_proc_info().

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/******************************************************
 
2
Sessions
 
3
 
 
4
(c) 1996 Innobase Oy
 
5
 
 
6
Created 6/25/1996 Heikki Tuuri
 
7
*******************************************************/
 
8
 
 
9
#include "usr0sess.h"
 
10
 
 
11
#ifdef UNIV_NONINL
 
12
#include "usr0sess.ic"
 
13
#endif
 
14
 
 
15
#include "trx0trx.h"
 
16
 
 
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. */
 
27
 
 
28
sess_t*
 
29
sess_open(void)
 
30
/*===========*/
 
31
                                        /* out, own: session object */
 
32
{
 
33
        sess_t* sess;
 
34
 
 
35
        ut_ad(mutex_own(&kernel_mutex));
 
36
 
 
37
        sess = mem_alloc(sizeof(sess_t));
 
38
 
 
39
        sess->state = SESS_ACTIVE;
 
40
 
 
41
        sess->trx = trx_create(sess);
 
42
 
 
43
        UT_LIST_INIT(sess->graphs);
 
44
 
 
45
        return(sess);
 
46
}
 
47
 
 
48
/*************************************************************************
 
49
Closes a session, freeing the memory occupied by it. */
 
50
static
 
51
void
 
52
sess_close(
 
53
/*=======*/
 
54
        sess_t* sess)   /* in, own: session object */
 
55
{
 
56
        ut_ad(mutex_own(&kernel_mutex));
 
57
        ut_ad(sess->trx == NULL);
 
58
 
 
59
        mem_free(sess);
 
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
 
 
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
}