diff options
Diffstat (limited to 'storage/innobase/ut/ut0wqueue.cc')
-rw-r--r-- | storage/innobase/ut/ut0wqueue.cc | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/storage/innobase/ut/ut0wqueue.cc b/storage/innobase/ut/ut0wqueue.cc index 1607e535a94..3df32d92a9b 100644 --- a/storage/innobase/ut/ut0wqueue.cc +++ b/storage/innobase/ut/ut0wqueue.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2006, 2011, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2006, 2015, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -16,6 +16,8 @@ this program; if not, write to the Free Software Foundation, Inc., *****************************************************************************/ +#include "ut0list.h" +#include "mem0mem.h" #include "ut0wqueue.h" /*******************************************************************//** @@ -25,29 +27,36 @@ A work queue Created 4/26/2006 Osku Salerma ************************************************************************/ +/* Work queue. */ +struct ib_wqueue_t { + ib_mutex_t mutex; /*!< mutex protecting everything */ + ib_list_t* items; /*!< work item list */ + os_event_t event; /*!< event we use to signal additions to list */ +}; + /****************************************************************//** Create a new work queue. -@return work queue */ -UNIV_INTERN +@return work queue */ ib_wqueue_t* ib_wqueue_create(void) /*===================*/ { - ib_wqueue_t* wq = static_cast<ib_wqueue_t*>(mem_alloc(sizeof(*wq))); + ib_wqueue_t* wq = static_cast<ib_wqueue_t*>( + ut_malloc_nokey(sizeof(*wq))); /* Function ib_wqueue_create() has not been used anywhere, not necessary to instrument this mutex */ - mutex_create(PFS_NOT_INSTRUMENTED, &wq->mutex, SYNC_WORK_QUEUE); + + mutex_create(LATCH_ID_WORK_QUEUE, &wq->mutex); wq->items = ib_list_create(); - wq->event = os_event_create(); + wq->event = os_event_create(0); return(wq); } /****************************************************************//** Free a work queue. */ -UNIV_INTERN void ib_wqueue_free( /*===========*/ @@ -55,14 +64,13 @@ ib_wqueue_free( { mutex_free(&wq->mutex); ib_list_free(wq->items); - os_event_free(wq->event); + os_event_destroy(wq->event); - mem_free(wq); + ut_free(wq); } /****************************************************************//** Add a work item to the queue. */ -UNIV_INTERN void ib_wqueue_add( /*==========*/ @@ -81,8 +89,7 @@ ib_wqueue_add( /****************************************************************//** Wait for a work item to appear in the queue. -@return work item */ -UNIV_INTERN +@return work item */ void* ib_wqueue_wait( /*===========*/ @@ -120,7 +127,6 @@ ib_wqueue_wait( /******************************************************************** Wait for a work item to appear in the queue for specified time. */ - void* ib_wqueue_timedwait( /*================*/ @@ -132,7 +138,7 @@ ib_wqueue_timedwait( for (;;) { ulint error; - ib_int64_t sig_count; + int64_t sig_count; mutex_enter(&wq->mutex); @@ -195,7 +201,6 @@ ib_wqueue_nowait( /******************************************************************** Check if queue is empty. */ - ibool ib_wqueue_is_empty( /*===============*/ |