Skip to content

Commit

Permalink
Fix access to shared paths variable
Browse files Browse the repository at this point in the history
  • Loading branch information
morpheusthewhite committed Jun 28, 2020
1 parent cec89c2 commit 09e0311
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/GraphParallelDFS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,12 @@ void GraphParallelDFS::convertToDT() {
packaged_task<void(int, int)> task_child([this, &paths, &node_mutexes, &mP, &P, &Br](int index, int current_parent){
int child = this->Ai_dag[index];

// existing path
vector<int> Qr = paths[child];

// lock mutex to access shared resources (paths and incoming_edges)
node_mutexes[child].lock();

// existing path
vector<int> Qr = paths[child];

// update the path in the case in which
// - The path is empty, so this is the first time we meet this child
// - We found a path Br which is better than the current one
Expand Down

0 comments on commit 09e0311

Please sign in to comment.