socketbreaker.h
607 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
38
39
40
//
// socketbreaker.h
// BBAAPIRequest
//
// Created by cairui01 on 2020/05/11.
//
#ifndef _SOCKSTBREAKER_
#define _SOCKSTBREAKER_
#include "lock.h"
class SocketBreaker {
public:
SocketBreaker();
~SocketBreaker();
bool IsCreateSuc() const;
bool ReCreate();
void Close();
bool Break();
bool Clear();
bool IsBreak() const;
int BreakerFD() const;
private:
SocketBreaker(const SocketBreaker&);
SocketBreaker& operator=(const SocketBreaker&);
private:
int pipes_[2];
bool create_success_;
bool broken_;
Mutex mutex_;
};
#endif