Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
idealvin committed Jul 4, 2022
1 parent d65eae2 commit fa26e74
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion include/co/tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class __coapi Client final {
const char* strerror() const;

// get the socket fd
int socket() const { return _fd; }
int socket() const { (void)_; return _fd; }

private:
union {
Expand All @@ -245,6 +245,7 @@ class __coapi Client final {
};
uint16 _port;
uint8 _use_ssl;
uint8 _;
int _fd;
};

Expand Down
2 changes: 1 addition & 1 deletion src/co/epoll/epoll.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void Epoll::handle_ev_pipe() {
break;
}
}
atomic_store(&_signaled, 0, mo_relaxed);
atomic_store(&_signaled, 0, mo_release);
}

} // co
Expand Down
2 changes: 1 addition & 1 deletion src/co/epoll/epoll.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Epoll {

// write one byte to the pipe to wake up the epoll.
void signal(char c = 'x') {
if (atomic_bool_cas(&_signaled, 0, 1, mo_relaxed, mo_relaxed)) {
if (atomic_bool_cas(&_signaled, 0, 1, mo_acq_rel, mo_acq_rel)) {
const int r = (int) CO_RAW_API(write)(_pipe_fds[1], &c, 1);
ELOG_IF(r != 1) << "pipe write error..";
}
Expand Down
2 changes: 1 addition & 1 deletion src/co/epoll/iocp.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Iocp {
}

void signal() {
if (atomic_compare_swap(&_signaled, 0, 1, mo_acquire, mo_acquire) == 0) {
if (atomic_bool_cas(&_signaled, 0, 1, mo_acquire, mo_acquire)) {
const BOOL r = PostQueuedCompletionStatus(_iocp, 0, 0, 0);
ELOG_IF(!r) << "PostQueuedCompletionStatus error: " << co::strerror();
}
Expand Down
2 changes: 1 addition & 1 deletion src/co/epoll/kqueue.cc
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ void Kqueue::handle_ev_pipe() {
break;
}
}
atomic_store(&_signaled, 0, mo_relaxed);
atomic_store(&_signaled, 0, mo_release);
}

} // co
Expand Down
2 changes: 1 addition & 1 deletion src/co/epoll/kqueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Kqueue {
}

void signal(char c = 'x') {
if (atomic_bool_cas(&_signaled, 0, 1, mo_relaxed, mo_relaxed)) {
if (atomic_bool_cas(&_signaled, 0, 1, mo_acq_rel, mo_acq_rel)) {
const int r = (int) CO_RAW_API(write)(_pipe_fds[1], &c, 1);
ELOG_IF(r != 1) << "pipe write error..";
}
Expand Down

0 comments on commit fa26e74

Please sign in to comment.