Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve MacLean <Steve.MacLean@microsoft.com>2021-01-28 20:22:14 +0300
committerGitHub <noreply@github.com>2021-01-28 20:22:14 +0300
commita9836c89598fdc7188bed56d331366d2214b9d2c (patch)
treeb752d5da638255d7e00177fae4f80aff4636eb67 /src/coreclr/pal
parentf8f1ee4d48202001552a5981813ef712e8b3a8b6 (diff)
Retry sem_wait() on EINTR (#47536)
Diffstat (limited to 'src/coreclr/pal')
-rw-r--r--src/coreclr/pal/src/thread/process.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/coreclr/pal/src/thread/process.cpp b/src/coreclr/pal/src/thread/process.cpp
index 062a7fea256..464013243d4 100644
--- a/src/coreclr/pal/src/thread/process.cpp
+++ b/src/coreclr/pal/src/thread/process.cpp
@@ -1735,15 +1735,21 @@ public:
TRACE("sem_wait(startup)\n");
// Wait until the coreclr runtime (debuggee) starts up
- if (sem_wait(m_startupSem) == 0)
- {
- pe = InvokeStartupCallback();
- }
- else
+ while (sem_wait(m_startupSem) != 0)
{
+ if (EINTR == errno)
+ {
+ TRACE("sem_wait() failed with EINTR; re-waiting");
+ continue;
+ }
TRACE("sem_wait(startup) failed: errno is %d (%s)\n", errno, strerror(errno));
pe = GetSemError();
}
+
+ if (pe == NO_ERROR)
+ {
+ pe = InvokeStartupCallback();
+ }
}
// Invoke the callback on errors
@@ -1905,8 +1911,13 @@ PAL_NotifyRuntimeStarted()
}
// Now wait until the debugger's runtime startup notification is finished
- if (sem_wait(continueSem) != 0)
+ while (sem_wait(continueSem) != 0)
{
+ if (EINTR == errno)
+ {
+ TRACE("sem_wait() failed with EINTR; re-waiting");
+ continue;
+ }
ASSERT("sem_wait(continueSem) failed: errno is %d (%s)\n", errno, strerror(errno));
goto exit;
}
@@ -4170,7 +4181,7 @@ PROCGetProcessStatus(
// have to try again. A second legitimate cause is ECHILD, which
// happens if we're trying to retrieve the status of a currently-
// running process that isn't a child of this process.
- if(EINTR == errno)
+ if (EINTR == errno)
{
TRACE("waitpid() failed with EINTR; re-waiting");
continue;