Hi Greg, I've removed the goto from the patch but left it in the places
where it already existed in the ProcessMonitor, let me know if you would
like those updated too.
Cheers,
Andrew
On Fri, Jan 24, 2014 at 7:10 PM, Greg Clayton <[email protected]> wrote:
> Can we get rid of the "goto" statement and make it a "while(1)" or
> "for(;;)" like the first part of the fix?
>
> On Jan 24, 2014, at 6:10 AM, Andrew MacPherson <[email protected]>
> wrote:
>
> > Fix a crash where if sem_wait is interrupted then
> ProcessMonitor::ServeOperation() will crash accessing an invalid
> monitor->m_operation pointer. The fix is taken from how this same case is
> already handled in the ProcessMonitor constructor.
> >
> > Thanks,
> > Andrew
> >
> <sem_wait.EINTR.Linux.patch>_______________________________________________
> > lldb-dev mailing list
> > [email protected]
> > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
>
>
diff --git a/source/Plugins/Process/Linux/ProcessMonitor.cpp b/source/Plugins/Process/Linux/ProcessMonitor.cpp
index 0f79034..98dd9df 100644
--- a/source/Plugins/Process/Linux/ProcessMonitor.cpp
+++ b/source/Plugins/Process/Linux/ProcessMonitor.cpp
@@ -2062,7 +2062,12 @@ ProcessMonitor::ServeOperation(OperationArgs *args)
for(;;)
{
// wait for next pending operation
- sem_wait(&monitor->m_operation_pending);
+ if (sem_wait(&monitor->m_operation_pending))
+ {
+ if (errno == EINTR)
+ continue;
+ assert(false && "Unexpected errno from sem_wait");
+ }
monitor->m_operation->Execute(monitor);
@@ -2082,7 +2087,12 @@ ProcessMonitor::DoOperation(Operation *op)
sem_post(&m_operation_pending);
// wait for operation to complete
- sem_wait(&m_operation_done);
+ while (sem_wait(&m_operation_done))
+ {
+ if (errno == EINTR)
+ continue;
+ assert(false && "Unexpected errno from sem_wait");
+ }
}
size_t
_______________________________________________
lldb-dev mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev