Skip to content

Commit

Permalink
dd
Browse files Browse the repository at this point in the history
  • Loading branch information
deanlee committed May 29, 2024
1 parent 8ed685f commit 5fe560d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions messaging/impl_msgq.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ Message * MSGQSubSocket::receive(bool non_blocking){
struct timespec ts{ms / 1000, (ms % 1000) * 1000000};
auto start_ts = nanos_since_boot();
while (rc == 0) {
siginfo_t siginfo;
int ret = timeout == -1 ? sigwaitinfo(&mask, &siginfo) : sigtimedwait(&mask, &siginfo, &ts);
int ret = timeout == -1 ? sigwaitinfo(&mask, nullptr) : sigtimedwait(&mask, nullptr, &ts);
if (ret == SIGINT || ret == SIGTERM) {
raise(ret);
break;
Expand All @@ -99,8 +98,7 @@ Message * MSGQSubSocket::receive(bool non_blocking){

// Recalculate remaining time if using a timeout
if (timeout != -1) {
auto delta = nanos_since_boot() - start_ts;
auto remaining = ms * 1000000 - delta;
auto remaining = ms * 1000000 - (nanos_since_boot() - start_ts);
if (remaining <=0) {
break;
}
Expand Down

0 comments on commit 5fe560d

Please sign in to comment.