MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
载入中...
搜索中...
未找到
thread_handler.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 2024/01/10.
13//
14
15#pragma once
16
17#include "common/sys/rc.h"
18
19class Communicator;
20
28{
29public:
30 ThreadHandler() = default;
31 virtual ~ThreadHandler() = default;
32
36 virtual RC start() = 0;
37
41 virtual RC stop() = 0;
42
46 virtual RC await_stop() = 0;
47
52 virtual RC new_connection(Communicator *communicator) = 0;
53
58 virtual RC close_connection(Communicator *communicator) = 0;
59
60public:
64 static ThreadHandler *create(const char *name);
65};
负责与客户端通讯
Definition: communicator.h:42
Definition: thread_handler.h:28
static ThreadHandler * create(const char *name)
创建一个线程模型
Definition: thread_handler.cpp:23
virtual RC start()=0
启动线程模型
virtual RC new_connection(Communicator *communicator)=0
有新的连接到达时,调用此接口
virtual RC stop()=0
停止线程模型
virtual RC close_connection(Communicator *communicator)=0
连接断开时,调用此接口。通常都是内部调用
virtual RC await_stop()=0
等待线程模型停止