[Lldb-commits] [lldb] r200049 - Fix crash on Linux if sem_wait() is interrupted.
Todd Fiala
tfiala at google.com
Fri Jan 24 14:59:22 PST 2014
Author: tfiala
Date: Fri Jan 24 16:59:22 2014
New Revision: 200049
URL: http://llvm.org/viewvc/llvm-project?rev=200049&view=rev
Log:
Fix crash on Linux if sem_wait() is interrupted.
Patch by Andrew MacPherson.
Modified:
lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp
Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp?rev=200049&r1=200048&r2=200049&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp Fri Jan 24 16:59:22 2014
@@ -2062,7 +2062,12 @@ ProcessMonitor::ServeOperation(Operation
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 *o
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
More information about the lldb-commits
mailing list