MySQL  8.0.19
Source Code Documentation
ut0wqueue.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (c) 2006, 2018, Oracle and/or its affiliates. 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, version 2.0, as published by the
7 Free Software Foundation.
8 
9 This program is also distributed with certain software (including but not
10 limited to OpenSSL) that is licensed under separate terms, as designated in a
11 particular file or component or in included license documentation. The authors
12 of MySQL hereby grant you an additional permission to link the program and
13 your derivative works with the separately licensed software that they have
14 included with MySQL.
15 
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
19 for more details.
20 
21 You should have received a copy of the GNU General Public License along with
22 this program; if not, write to the Free Software Foundation, Inc.,
23 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 
25 *****************************************************************************/
26 
27 /** @file include/ut0wqueue.h
28  A work queue
29 
30  Created 4/26/2006 Osku Salerma
31  ************************************************************************/
32 
33 /** A Work queue. Threads can add work items to the queue and other threads can
34  wait for work items to be available and take them off the queue for
35  processing.
36  ************************************************************************/
37 
38 #ifndef IB_WORK_QUEUE_H
39 #define IB_WORK_QUEUE_H
40 
41 #include "mem0mem.h"
42 #include "sync0sync.h"
43 #include "ut0list.h"
44 
45 // Forward declaration
46 struct ib_list_t;
47 struct ib_wqueue_t;
48 
49 /** Create a new work queue.
50  @return work queue */
52 
53 /** Free a work queue. */
54 void ib_wqueue_free(ib_wqueue_t *wq); /*!< in: work queue */
55 
56 /** Add a work item to the queue. */
57 void ib_wqueue_add(ib_wqueue_t *wq, /*!< in: work queue */
58  void *item, /*!< in: work item */
59  mem_heap_t *heap); /*!< in: memory heap to use for
60  allocating the list node */
61 
62 /********************************************************************
63 Check if queue is empty. */
64 ibool ib_wqueue_is_empty(
65  /* out: TRUE if queue empty
66  else FALSE */
67  const ib_wqueue_t *wq); /* in: work queue */
68 
69 /********************************************************************
70 Wait for a work item to appear in the queue for specified time. */
72  /* out: work item or NULL on timeout*/
73  ib_wqueue_t *wq, /* in: work queue */
74  ib_time_t wait_in_usecs); /* in: wait time in micro seconds */
75 
76 #endif /* IB_WORK_QUEUE_H */
ut0list.h
ib_wqueue_is_empty
ibool ib_wqueue_is_empty(const ib_wqueue_t *wq)
Definition: ut0wqueue.cc:128
mem0mem.h
ib_wqueue_t
Definition: ut0wqueue.cc:42
ib_wqueue_timedwait
void * ib_wqueue_timedwait(ib_wqueue_t *wq, ib_time_t wait_in_usecs)
Definition: ut0wqueue.cc:90
mem_block_info_t
The info structure stored at the beginning of a heap block.
Definition: mem0mem.h:337
ib_wqueue_free
void ib_wqueue_free(ib_wqueue_t *wq)
Free a work queue.
Definition: ut0wqueue.cc:65
ib_wqueue_create
ib_wqueue_t * ib_wqueue_create()
Create a new work queue.
Definition: ut0wqueue.cc:50
ib_list_t
Definition: ut0list.h:97
sync0sync.h
ib_wqueue_add
void ib_wqueue_add(ib_wqueue_t *wq, void *item, mem_heap_t *heap)
Add a work item to the queue.
Definition: ut0wqueue.cc:75
ib_time_t
time_t ib_time_t
Time stamp.
Definition: ut0ut.h:85