Skip to content

Commit

Permalink
Tweak ordering for releasing ThreadNexus lock.
Browse files Browse the repository at this point in the history
  • Loading branch information
brixen committed Jun 25, 2016
1 parent 2d7d69c commit 1f65038
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions machine/thread_nexus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,21 +205,21 @@ namespace rubinius {
id = 0;
}

/* Lock and hold the waiting_mutex to prevent any other thread from
* holding it across a fork() call.
*/
// Checkpoint all the other threads.
ns = 0;

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

detect_deadlock(ns, lock_limit);
}

// Checkpoint all the other threads.
/* Lock and hold the waiting_mutex to prevent any other thread from
* holding it across a fork() call.
*/
ns = 0;

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

detect_deadlock(ns, lock_limit);
Expand Down
2 changes: 1 addition & 1 deletion machine/thread_nexus.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ namespace rubinius {

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

bool try_checkpoint(VM* vm);
Expand Down

0 comments on commit 1f65038

Please sign in to comment.