MCPcopy Create free account
hub / github.com/KangLin/RabbitRemoteControl / Reset

Method Reset

Src/Event.cpp:84–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84int CEvent::Reset()
85{
86 int nRet = 0;
87 if(INVALID_SOCKET == fd[0])
88 return -1;
89
90 //qDebug(log) << "Reset()";
91#if HAVE_EVENTFD
92 eventfd_t value;
93 nRet = eventfd_read(fd[0], &value);
94 //qDebug(log) << "read eventfd:" << value;
95 if(nRet) {
96 if(EAGAIN == errno || EWOULDBLOCK == errno)
97 return 0;
98 qDebug(log) << "eventfd_read fail" << errno << "-" << strerror(errno);
99 }
100#else
101 const int len = 1;
102 char buf[len];
103 nRet = recv(fd[0], buf, len, 0);
104 if(nRet >= 0) {
105 //qDebug(log) << "recv" << nRet;
106 return 0;
107 }
108 if(nRet < 0) {
109 if(EAGAIN == errno || EWOULDBLOCK == errno)
110 return 0;
111 qDebug(log) << "recv fail. nRet:" << nRet << "fd:" << fd[0]
112 << "error:" << errno << "-" << strerror(errno);
113 }
114#endif
115 return nRet;
116}
117
118int CEvent::WakeUp()
119{

Callers 4

ProcessMethod · 0.80
OnProcessMethod · 0.80
ProcessMethod · 0.80
OnProcessMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected