https://github.com/labath commented:

Small patch, but a lot of comments:
- with the last round of MainLoop changes, the sigmask changes aren't necessary 
anymore -- just drop them (this also sort of means we could just use `poll` 
everywhere, but I kinda like it because of the increased precision.
- you need to used the timeout field -- required due the last set of changes
- let's make this conditional on `HAVE_PPOLL` instead of `!_AIX`
- let's move the code into a helper function

Putting everything together, I think the code should be something like this:

```
// If nfds_t doesn't exist on AIX, just use size_t
static int Poll(ArrayRef<struct pollfd> fds, 
std::optional<MainLoopPosix::TimePoint> point) {
#ifdef HAVE_PPOLL
  return ppoll(fds.data(), fds.size(),
            ToTimeSpec(loop.GetNextWakeupTime()),
            /*sigmask=*/nullptr);
#else
  using namespace std::chrono;
  int timeout = -1;
  if (point) {
    nanosecond dur = std::max(*point - steady_clock::now(), nanoseconds(0));
    timeout = ceil<milliseconds>(dur).count();
  }
  return poll(fds.data(), fds.size(), timeout);
#endif
}
```

Please also make sure all of the MainLoop unit tests pass with this change. 
Ideally on AIX, but if you still can't get even the unit test binary to build 
then at least by "simulating" it by undefining the HAVE_PPOLL macro.

https://github.com/llvm/llvm-project/pull/120378
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to