wake shouldn't be const because condition_variable are not const in the notfication process

This commit is contained in:
keldu.magnus 2020-11-18 15:16:37 +01:00
parent 08b8c87c39
commit f5cecb48c4
2 changed files with 20 additions and 20 deletions

View File

@ -113,7 +113,7 @@ private:
for (int i = 0; i < nfds; ++i) {
if (events[i].data.u64 == 0) {
while(1) {
while (1) {
struct ::signalfd_siginfo siginfo;
ssize_t n =
::read(signal_fd, &siginfo, sizeof(siginfo));
@ -124,14 +124,14 @@ private:
notifySignalListener(siginfo.ssi_signo);
}
} else if( events[i].data.u64 == 1){
} else if (events[i].data.u64 == 1) {
uint8_t i;
if(pipefds[0] < 0){
if (pipefds[0] < 0) {
continue;
}
while(1){
while (1) {
ssize_t n = ::read(pipefds[0], &i, sizeof(i));
if(n < 0){
if (n < 0) {
break;
}
}
@ -170,7 +170,7 @@ public:
::epoll_ctl(epoll_fd, EPOLL_CTL_ADD, signal_fd, &event);
int rc = ::pipe(pipefds);
if(rc < 0){
if (rc < 0) {
return;
}
memset(&event, 0, sizeof(event));
@ -225,10 +225,10 @@ public:
}
}
void wake() const override {
/// @todo pipe() in the beginning and write something minor into it like uint8_t or sth
/// the value itself doesn't matter
if(pipefds[1] < 0){
void wake() override {
/// @todo pipe() in the beginning and write something minor into it like
/// uint8_t or sth the value itself doesn't matter
if (pipefds[1] < 0) {
return;
}
uint8_t i = 0;

View File

@ -25,9 +25,9 @@ public:
class EventLoop;
/*
* Event class inspired directly by capn'proto.
* https://github.com/capnproto/capnproto
*/
* Event class inspired directly by capn'proto.
* https://github.com/capnproto/capnproto
*/
class Event {
private:
EventLoop &loop;
@ -217,7 +217,7 @@ public:
virtual void wait(const std::chrono::steady_clock::duration &) = 0;
virtual void wait(const std::chrono::steady_clock::time_point &) = 0;
virtual void wake() const = 0;
virtual void wake() = 0;
};
class SinkConveyorNode;
@ -244,9 +244,9 @@ public:
};
/*
* EventLoop class inspired directly by capn'proto.
* https://github.com/capnproto/capnproto
*/
* EventLoop class inspired directly by capn'proto.
* https://github.com/capnproto/capnproto
*/
class EventLoop {
private:
friend class Event;
@ -287,9 +287,9 @@ public:
};
/*
* WaitScope class inspired directly by capn'proto.
* https://github.com/capnproto/capnproto
*/
* WaitScope class inspired directly by capn'proto.
* https://github.com/capnproto/capnproto
*/
class WaitScope {
private:
EventLoop &loop;