11
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
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
17
17
*****************************************************************************/
19
19
#include "ut0wqueue.h"
21
/*******************************************************************//**
25
Created 4/26/2006 Osku Salerma
26
************************************************************************/
28
/****************************************************************//**
29
Create a new work queue.
21
/********************************************************************
22
Create a new work queue. */
33
25
ib_wqueue_create(void)
34
26
/*===================*/
36
29
ib_wqueue_t* wq = mem_alloc(sizeof(ib_wqueue_t));
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);
42
33
wq->items = ib_list_create();
43
34
wq->event = os_event_create(NULL);
48
/****************************************************************//**
39
/********************************************************************
49
40
Free a work queue. */
54
ib_wqueue_t* wq) /*!< in: work queue */
45
ib_wqueue_t* wq) /* in: work queue */
56
47
ut_a(!ib_list_get_first(wq->items));
65
/****************************************************************//**
56
/********************************************************************
66
57
Add a work item to the queue. */
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
76
67
mutex_enter(&wq->mutex);
81
72
mutex_exit(&wq->mutex);
84
/****************************************************************//**
85
Wait for a work item to appear in the queue.
75
/********************************************************************
76
Wait for a work item to appear in the queue. */
91
ib_wqueue_t* wq) /*!< in: work queue */
81
ib_wqueue_t* wq) /* in: work queue */
93
83
ib_list_node_t* node;