[Lldb-commits] [lldb] [lldb][AIX] AIX Changes for MainLoop polling (PR #120378)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Wed Dec 18 02:04:49 PST 2024
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
More information about the lldb-commits
mailing list