Skip to content

Commit cf6a863

Browse files
AIX Changes for MainLoop
1 parent 04313b8 commit cf6a863

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

lldb/source/Host/posix/MainLoopPosix.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,23 @@ Status MainLoopPosix::RunImpl::Poll() {
170170
read_fds.push_back(pfd);
171171
}
172172

173+
#if defined(_AIX)
174+
sigset_t origmask;
175+
int timeout;
176+
177+
timeout = -1;
178+
pthread_sigmask(SIG_SETMASK, nullptr, &origmask);
179+
int ready = poll(read_fds.data(), read_fds.size(), timeout);
180+
pthread_sigmask(SIG_SETMASK, &origmask, nullptr);
181+
if (ready == -1 && errno != EINTR)
182+
return Status(errno, eErrorTypePOSIX);
183+
#else
173184
if (ppoll(read_fds.data(), read_fds.size(),
174185
ToTimeSpec(loop.GetNextWakeupTime()),
175186
/*sigmask=*/nullptr) == -1 &&
176187
errno != EINTR)
177188
return Status(errno, eErrorTypePOSIX);
189+
#endif
178190

179191
return Status();
180192
}
@@ -226,13 +238,13 @@ MainLoopPosix::~MainLoopPosix() {
226238
#endif
227239
m_read_fds.erase(m_interrupt_pipe.GetReadFileDescriptor());
228240
m_interrupt_pipe.Close();
229-
assert(m_read_fds.size() == 0);
241+
assert(m_read_fds.size() == 0);
230242
assert(m_signals.size() == 0);
231243
}
232244

233245
MainLoopPosix::ReadHandleUP
234246
MainLoopPosix::RegisterReadObject(const IOObjectSP &object_sp,
235-
const Callback &callback, Status &error) {
247+
const Callback &callback, Status &error) {
236248
if (!object_sp || !object_sp->IsValid()) {
237249
error = Status::FromErrorString("IO object is not valid.");
238250
return nullptr;

0 commit comments

Comments
 (0)