~ubuntu-branches/ubuntu/vivid/mariadb-5.5/vivid

« back to all changes in this revision

Viewing changes to storage/tokudb/ft-index/ft/queue.h

  • Committer: Package Import Robot
  • Author(s): Otto Kekäläinen
  • Date: 2014-11-14 21:04:24 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20141114210424-xlyna0ozl11647o5
Tags: 5.5.40-0ubuntu0.14.10.1
* SECURITY UPDATE: Update to 5.5.40 to fix security issues (LP: #1391676)
  - CVE-2014-6507
  - CVE-2014-6491
  - CVE-2014-6500
  - CVE-2014-6469
  - CVE-2014-6555
  - CVE-2014-6559
  - CVE-2014-6494
  - CVE-2014-6496
  - CVE-2014-6464
* Add bsdutils as mariadb-server dependency like upstream does in 5.5.40.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
 
// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4:
3
 
#ifndef TOKU_QUEUE_H
4
 
#define TOKU_QUEUE_H
5
 
 
6
 
#ident "$Id$"
7
 
/*
8
 
COPYING CONDITIONS NOTICE:
9
 
 
10
 
  This program is free software; you can redistribute it and/or modify
11
 
  it under the terms of version 2 of the GNU General Public License as
12
 
  published by the Free Software Foundation, and provided that the
13
 
  following conditions are met:
14
 
 
15
 
      * Redistributions of source code must retain this COPYING
16
 
        CONDITIONS NOTICE, the COPYRIGHT NOTICE (below), the
17
 
        DISCLAIMER (below), the UNIVERSITY PATENT NOTICE (below), the
18
 
        PATENT MARKING NOTICE (below), and the PATENT RIGHTS
19
 
        GRANT (below).
20
 
 
21
 
      * Redistributions in binary form must reproduce this COPYING
22
 
        CONDITIONS NOTICE, the COPYRIGHT NOTICE (below), the
23
 
        DISCLAIMER (below), the UNIVERSITY PATENT NOTICE (below), the
24
 
        PATENT MARKING NOTICE (below), and the PATENT RIGHTS
25
 
        GRANT (below) in the documentation and/or other materials
26
 
        provided with the distribution.
27
 
 
28
 
  You should have received a copy of the GNU General Public License
29
 
  along with this program; if not, write to the Free Software
30
 
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
31
 
  02110-1301, USA.
32
 
 
33
 
COPYRIGHT NOTICE:
34
 
 
35
 
  TokuDB, Tokutek Fractal Tree Indexing Library.
36
 
  Copyright (C) 2007-2013 Tokutek, Inc.
37
 
 
38
 
DISCLAIMER:
39
 
 
40
 
  This program is distributed in the hope that it will be useful, but
41
 
  WITHOUT ANY WARRANTY; without even the implied warranty of
42
 
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
43
 
  General Public License for more details.
44
 
 
45
 
UNIVERSITY PATENT NOTICE:
46
 
 
47
 
  The technology is licensed by the Massachusetts Institute of
48
 
  Technology, Rutgers State University of New Jersey, and the Research
49
 
  Foundation of State University of New York at Stony Brook under
50
 
  United States of America Serial No. 11/760379 and to the patents
51
 
  and/or patent applications resulting from it.
52
 
 
53
 
PATENT MARKING NOTICE:
54
 
 
55
 
  This software is covered by US Patent No. 8,185,551.
56
 
  This software is covered by US Patent No. 8,489,638.
57
 
 
58
 
PATENT RIGHTS GRANT:
59
 
 
60
 
  "THIS IMPLEMENTATION" means the copyrightable works distributed by
61
 
  Tokutek as part of the Fractal Tree project.
62
 
 
63
 
  "PATENT CLAIMS" means the claims of patents that are owned or
64
 
  licensable by Tokutek, both currently or in the future; and that in
65
 
  the absence of this license would be infringed by THIS
66
 
  IMPLEMENTATION or by using or running THIS IMPLEMENTATION.
67
 
 
68
 
  "PATENT CHALLENGE" shall mean a challenge to the validity,
69
 
  patentability, enforceability and/or non-infringement of any of the
70
 
  PATENT CLAIMS or otherwise opposing any of the PATENT CLAIMS.
71
 
 
72
 
  Tokutek hereby grants to you, for the term and geographical scope of
73
 
  the PATENT CLAIMS, a non-exclusive, no-charge, royalty-free,
74
 
  irrevocable (except as stated in this section) patent license to
75
 
  make, have made, use, offer to sell, sell, import, transfer, and
76
 
  otherwise run, modify, and propagate the contents of THIS
77
 
  IMPLEMENTATION, where such license applies only to the PATENT
78
 
  CLAIMS.  This grant does not include claims that would be infringed
79
 
  only as a consequence of further modifications of THIS
80
 
  IMPLEMENTATION.  If you or your agent or licensee institute or order
81
 
  or agree to the institution of patent litigation against any entity
82
 
  (including a cross-claim or counterclaim in a lawsuit) alleging that
83
 
  THIS IMPLEMENTATION constitutes direct or contributory patent
84
 
  infringement, or inducement of patent infringement, then any rights
85
 
  granted to you under this License shall terminate as of the date
86
 
  such litigation is filed.  If you or your agent or exclusive
87
 
  licensee institute or order or agree to the institution of a PATENT
88
 
  CHALLENGE, then Tokutek may terminate any rights granted to you
89
 
  under this License.
90
 
*/
91
 
 
92
 
#ident "Copyright (c) 2007-2013 Tokutek Inc.  All rights reserved."
93
 
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
94
 
 
95
 
#include "fttypes.h"
96
 
 
97
 
// The abstraction:
98
 
//
99
 
// queue.h implements a queue suitable for a producer-consumer relationship between two pthreads.
100
 
// The enqueue/dequeue operation is fairly heavyweight (involving pthread condition variables) so it may be useful
101
 
// to enqueue large chunks rather than small chunks.
102
 
// It probably won't work right to have two consumer threads.
103
 
//
104
 
// Every item inserted into the queue has a weight.  If the weight
105
 
// gets too big, then the queue blocks on trying to insert more items.
106
 
// The weight can be used to limit the total number of items in the
107
 
// queue (weight of each item=1) or the total memory consumed by queue
108
 
// items (weight of each item is its size).  Or the weight's could all be
109
 
// zero for an unlimited queue.
110
 
 
111
 
typedef struct queue *QUEUE;
112
 
 
113
 
int queue_create (QUEUE *q, uint64_t weight_limit);
114
 
// Effect: Create a queue with a given weight limit.  The queue is initially empty.
115
 
 
116
 
int queue_enq (QUEUE q, void *item, uint64_t weight, uint64_t *total_weight_after_enq);
117
 
// Effect: Insert ITEM of weight WEIGHT into queue.  If the resulting contents weight too much then block (don't return) until the total weight is low enough.
118
 
// If total_weight_after_enq!=NULL then return the current weight of the items in the queue (after finishing blocking on overweight, and after enqueueing the item).
119
 
// If successful return 0.
120
 
// If an error occurs, return the error number, and the state of the queue is undefined.  The item may have been enqueued or not, and in fact the queue may be badly corrupted if the condition variables go awry.  If it's just a matter of out-of-memory, then the queue is probably OK.
121
 
// Requires: There is only a single consumer. (We wake up the consumer using a pthread_cond_signal (which is suitable only for single consumers.)
122
 
 
123
 
int queue_eof (QUEUE q);
124
 
// Effect: Inform the queue that no more values will be inserted.  After all the values that have been inserted are dequeued, further dequeue operations will return EOF.
125
 
// Returns 0 on success.   On failure, things are pretty bad (likely to be some sort of mutex failure).
126
 
 
127
 
int queue_deq (QUEUE q, void **item, uint64_t *weight, uint64_t *total_weight_after_deq);
128
 
// Effect: Wait until the queue becomes nonempty.  Then dequeue and return the oldest item.  The item and its weight are returned in *ITEM.
129
 
// If weight!=NULL then return the item's weight in *weight.
130
 
// If total_weight_after_deq!=NULL then return the current weight of the items in the queue (after dequeuing the item).
131
 
// Return 0 if an item is returned.
132
 
// Return EOF is we no more items will be returned.
133
 
// Usage note: The queue should be destroyed only after any consumers will no longer look at it (for example, they saw EOF).
134
 
 
135
 
int queue_destroy (QUEUE q);
136
 
// Effect: Destroy the queue.
137
 
// Requires: The queue must be empty and no consumer should try to dequeue after this (one way to do this is to make sure the consumer saw EOF).
138
 
// Returns 0 on success.   If the queue is not empty, returns EINVAL.  Other errors are likely to be bad (some sort of mutex or condvar failure).
139
 
 
140
 
#endif