MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
载入中...
搜索中...
未找到
queue.h
1/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
2miniob is licensed under Mulan PSL v2.
3You can use this software according to the terms and conditions of the Mulan PSL v2.
4You may obtain a copy of Mulan PSL v2 at:
5 http://license.coscl.org.cn/MulanPSL2
6THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
7EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
8MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
9See the Mulan PSL v2 for more details. */
10
11//
12// Created by Wangyunlai on 2023/01/11.
13//
14
15#pragma once
16
17namespace common {
18
29template <typename T>
30class Queue
31{
32public:
33 using value_type = T;
34
35public:
36 Queue() = default;
37 virtual ~Queue() = default;
38
45 virtual int push(value_type &&value) = 0;
46
53 virtual int pop(value_type &value) = 0;
54
60 virtual int size() const = 0;
61};
62
63} // namespace common
任务队列接口
Definition: queue.h:31
virtual int pop(value_type &value)=0
从队列中取出一个任务
virtual int push(value_type &&value)=0
在队列中放一个任务
virtual int size() const =0
当前队列中任务的数量