Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rubinius/rubinius
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1f6503886aab
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2395d0559836
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Jun 25, 2016

  1. Retry execvp on EAGAIN.

    brixen committed Jun 25, 2016

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    e4cb7bc View commit details
  2. Copy the full SHA
    2395d05 View commit details
Showing with 25 additions and 10 deletions.
  1. +18 −3 machine/builtin/system.cpp
  2. +7 −6 machine/thread_nexus.cpp
  3. +0 −1 machine/thread_nexus.hpp
21 changes: 18 additions & 3 deletions machine/builtin/system.cpp
Original file line number Diff line number Diff line change
@@ -205,7 +205,14 @@ namespace rubinius {
args[idx] = 0;

// If we added anything, then exec, otherwise fall through and fail.
if(idx > 0) execvp(args[0], args);
if(idx > 0) {
for(int i = 0; i < 5; i++) {
if(::execvp(args[0], args) < 0) {
if(errno != EAGAIN) break;
}
}
}

// If we failed, clean up the args.
delete[] args;
}
@@ -460,7 +467,11 @@ namespace rubinius {
}

if(exe.argc()) {
(void)::execvp(exe.command(), exe.argv());
for(int i = 0; i < 5; i++) {
if(::execvp(exe.command(), exe.argv()) < 0) {
if(errno != EAGAIN) break;
}
}
} else {
exec_sh_fallback(state, exe.command(), exe.command_size());
}
@@ -750,7 +761,11 @@ namespace rubinius {
}

if(exe.argc()) {
(void)::execvp(exe.command(), exe.argv());
for(int i = 0; i < 5; i++) {
if(::execvp(exe.command(), exe.argv()) < 0) {
if(errno != EAGAIN) break;
}
}
} else {
exec_sh_fallback(state, exe.command(), exe.command_size());
}
13 changes: 7 additions & 6 deletions machine/thread_nexus.cpp
Original file line number Diff line number Diff line change
@@ -206,8 +206,9 @@ namespace rubinius {
}

// Checkpoint all the other threads.
ns = 0;
set_stop();

ns = 0;
while(!try_checkpoint(vm)) {
ns += delay();

@@ -218,7 +219,6 @@ namespace rubinius {
* holding it across a fork() call.
*/
ns = 0;

while(!waiting_mutex_.try_lock()) {
ns += delay();

@@ -229,7 +229,6 @@ namespace rubinius {
* logger depends on is not held across fork() calls.
*/
ns = 0;

while(!logger::try_lock()) {
ns += delay();

@@ -240,12 +239,14 @@ namespace rubinius {
}

void ThreadNexus::fork_unlock(LockStatus status) {
logger::unlock();

waiting_condition_.notify_all();
waiting_mutex_.unlock();

if(status == eLocked) {
phase_flag_ = 0;
}

logger::unlock();
waiting_mutex_.unlock();
}

bool ThreadNexus::try_checkpoint(VM* vm) {
1 change: 0 additions & 1 deletion machine/thread_nexus.hpp
Original file line number Diff line number Diff line change
@@ -156,7 +156,6 @@ namespace rubinius {
}

void unlock() {
std::lock_guard<std::mutex> guard(waiting_mutex_);
waiting_condition_.notify_all();
phase_flag_ = 0;
}