-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBridge.h
More file actions
37 lines (28 loc) · 695 Bytes
/
Copy pathBridge.h
File metadata and controls
37 lines (28 loc) · 695 Bytes
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
#if !defined(MUDUO_BRIDGE_H)
#define MUDUO_BRIDGE_H
#include <muduo/base/allocator/Allocatable.h>
#include <memory>
namespace muduo {
class EventLoop; // forward declaration
class Channel; // forward declaration
/**
* Bridge for Multi-thread synchronization.
* Be used as an event wait/notify mechanism
*/
#ifdef MUDUO_USE_MEMPOOL
class Bridge : public base::detail::Allocatable {
#else
class Bridge {
#endif
public:
explicit Bridge(EventLoop* loop);
~Bridge() noexcept;
void WakeUp() const;
private:
void HandleWakeUpFdRead() const;
private:
EventLoop* const owner_;
std::unique_ptr<Channel> chan_; // wake-up fd channel
};
}
#endif // MUDUO_BRIDGE_H