MCPcopy Create free account
hub / github.com/apache/brpc / PlatformThreadHandle

Class PlatformThreadHandle

src/butil/threading/platform_thread.h:68–109  ·  view source on GitHub ↗

Used to operate on threads.

Source from the content-addressed store, hash-verified

66
67// Used to operate on threads.
68class PlatformThreadHandle {
69 public:
70#if defined(OS_WIN)
71 typedef void* Handle;
72#elif defined(OS_POSIX)
73 typedef pthread_t Handle;
74#endif
75
76 PlatformThreadHandle()
77 : handle_(0),
78 id_(0) {
79 }
80
81 explicit PlatformThreadHandle(Handle handle)
82 : handle_(handle),
83 id_(0) {
84 }
85
86 PlatformThreadHandle(Handle handle,
87 PlatformThreadId id)
88 : handle_(handle),
89 id_(id) {
90 }
91
92 bool is_equal(const PlatformThreadHandle& other) const {
93 return handle_ == other.handle_;
94 }
95
96 bool is_null() const {
97 return !handle_;
98 }
99
100 Handle platform_handle() const {
101 return handle_;
102 }
103
104 private:
105 friend class PlatformThread;
106
107 Handle handle_;
108 PlatformThreadId id_;
109};
110
111const PlatformThreadId kInvalidThreadId(0);
112

Callers 2

ThreadFuncFunction · 0.85
CurrentHandleMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected