-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathchannel.h
39 lines (29 loc) · 1.01 KB
/
channel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*******************************************
Author : Jun Zhang
Email : [email protected]
Last Modified : 2019-08-14 23:09
Filename : channel.h
Description :
*******************************************/
#pragma once
#include <memory>
#include <bthread/execution_queue.h>
#include "engine_manager.h"
namespace sogou {
class Channel {
public:
//Channel(EngineManager* mgr);
Channel();
~Channel() {}
int Start();
int Stop();
bool Enqueue(Closure closure);
static int run_loop(void*, ::bthread::TaskIterator<std::function<void()>>& iter);
bool Process(const Request* request, Response* response, size_t id, Closure closure);
bool InternalProcess(const Request* request, Response* response, size_t id, Closure closure);
private:
//EngineManager* mgr_{nullptr};
//::bthread::ExecutionQueueId<std::shared_ptr<Closure>> exec_queue_;
::bthread::ExecutionQueueId<Closure> exec_queue_;
};
}