~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/ut/ut0wqueue.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
19
#include "ut0wqueue.h"
20
20
 
21
 
/*******************************************************************//**
22
 
@file ut/ut0wqueue.c
23
 
A work queue
24
 
 
25
 
Created 4/26/2006 Osku Salerma
26
 
************************************************************************/
27
 
 
28
 
/****************************************************************//**
29
 
Create a new work queue.
30
 
@return work queue */
 
21
/********************************************************************
 
22
Create a new work queue. */
31
23
UNIV_INTERN
32
24
ib_wqueue_t*
33
25
ib_wqueue_create(void)
34
26
/*===================*/
 
27
                        /* out: work queue */
35
28
{
36
29
        ib_wqueue_t*    wq = mem_alloc(sizeof(ib_wqueue_t));
37
30
 
38
 
        /* Function ib_wqueue_create() has not been used anywhere,
39
 
        not necessary to instrument this mutex */
40
 
        mutex_create(PFS_NOT_INSTRUMENTED, &wq->mutex, SYNC_WORK_QUEUE);
 
31
        mutex_create(&wq->mutex, SYNC_WORK_QUEUE);
41
32
 
42
33
        wq->items = ib_list_create();
43
34
        wq->event = os_event_create(NULL);
45
36
        return(wq);
46
37
}
47
38
 
48
 
/****************************************************************//**
 
39
/********************************************************************
49
40
Free a work queue. */
50
41
UNIV_INTERN
51
42
void
52
43
ib_wqueue_free(
53
44
/*===========*/
54
 
        ib_wqueue_t*    wq)     /*!< in: work queue */
 
45
        ib_wqueue_t*    wq)     /* in: work queue */
55
46
{
56
47
        ut_a(!ib_list_get_first(wq->items));
57
48
 
62
53
        mem_free(wq);
63
54
}
64
55
 
65
 
/****************************************************************//**
 
56
/********************************************************************
66
57
Add a work item to the queue. */
67
58
UNIV_INTERN
68
59
void
69
60
ib_wqueue_add(
70
61
/*==========*/
71
 
        ib_wqueue_t*    wq,     /*!< in: work queue */
72
 
        void*           item,   /*!< in: work item */
73
 
        mem_heap_t*     heap)   /*!< in: memory heap to use for allocating the
 
62
        ib_wqueue_t*    wq,     /* in: work queue */
 
63
        void*           item,   /* in: work item */
 
64
        mem_heap_t*     heap)   /* in: memory heap to use for allocating the
74
65
                                list node */
75
66
{
76
67
        mutex_enter(&wq->mutex);
81
72
        mutex_exit(&wq->mutex);
82
73
}
83
74
 
84
 
/****************************************************************//**
85
 
Wait for a work item to appear in the queue.
86
 
@return work item */
 
75
/********************************************************************
 
76
Wait for a work item to appear in the queue. */
87
77
UNIV_INTERN
88
78
void*
89
79
ib_wqueue_wait(
90
 
/*===========*/
91
 
        ib_wqueue_t*    wq)     /*!< in: work queue */
 
80
                                /* out: work item */
 
81
        ib_wqueue_t*    wq)     /* in: work queue */
92
82
{
93
83
        ib_list_node_t* node;
94
84