~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/include/ut0wqueue.h

  • Committer: Monty Taylor
  • Date: 2009-03-06 03:33:24 UTC
  • mfrom: (916.1.2 merge)
  • Revision ID: mordred@inaugust.com-20090306033324-dcedf80g9qzywbvu
Merged Brian's merge... re-rotate the tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****************************************************************************
2
 
 
3
 
Copyright (c) 2006, 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 include/ut0wqueue.h
21
 
A work queue
22
 
 
23
 
Created 4/26/2006 Osku Salerma
24
 
************************************************************************/
25
 
 
26
 
/*******************************************************************//**
 
1
/***********************************************************************
27
2
A Work queue. Threads can add work items to the queue and other threads can
28
3
wait for work items to be available and take them off the queue for
29
4
processing.
 
5
 
30
6
************************************************************************/
31
7
 
32
8
#ifndef IB_WORK_QUEUE_H
39
15
 
40
16
typedef struct ib_wqueue_struct ib_wqueue_t;
41
17
 
42
 
/****************************************************************//**
43
 
Create a new work queue.
44
 
@return work queue */
 
18
/********************************************************************
 
19
Create a new work queue. */
45
20
UNIV_INTERN
46
21
ib_wqueue_t*
47
22
ib_wqueue_create(void);
48
23
/*===================*/
 
24
                        /* out: work queue */
49
25
 
50
 
/****************************************************************//**
 
26
/********************************************************************
51
27
Free a work queue. */
52
28
UNIV_INTERN
53
29
void
54
30
ib_wqueue_free(
55
31
/*===========*/
56
 
        ib_wqueue_t*    wq);    /*!< in: work queue */
 
32
        ib_wqueue_t*    wq);    /* in: work queue */
57
33
 
58
 
/****************************************************************//**
 
34
/********************************************************************
59
35
Add a work item to the queue. */
60
36
UNIV_INTERN
61
37
void
62
38
ib_wqueue_add(
63
39
/*==========*/
64
 
        ib_wqueue_t*    wq,     /*!< in: work queue */
65
 
        void*           item,   /*!< in: work item */
66
 
        mem_heap_t*     heap);  /*!< in: memory heap to use for allocating the
 
40
        ib_wqueue_t*    wq,     /* in: work queue */
 
41
        void*           item,   /* in: work item */
 
42
        mem_heap_t*     heap);  /* in: memory heap to use for allocating the
67
43
                                list node */
68
44
 
69
 
/****************************************************************//**
70
 
Wait for a work item to appear in the queue.
71
 
@return work item */
 
45
/********************************************************************
 
46
Wait for a work item to appear in the queue. */
72
47
UNIV_INTERN
73
48
void*
74
49
ib_wqueue_wait(
75
 
/*===========*/
76
 
        ib_wqueue_t*    wq);    /*!< in: work queue */
 
50
                                /* out: work item */
 
51
        ib_wqueue_t*    wq);    /* in: work queue */
77
52
 
78
53
/* Work queue. */
79
54
struct ib_wqueue_struct {
80
 
        mutex_t         mutex;  /*!< mutex protecting everything */
81
 
        ib_list_t*      items;  /*!< work item list */
82
 
        os_event_t      event;  /*!< event we use to signal additions to list */
 
55
        mutex_t         mutex;  /* mutex protecting everything */
 
56
        ib_list_t*      items;  /* work item list */
 
57
        os_event_t      event;  /* event we use to signal additions to list */
83
58
};
84
59
 
85
60
#endif