Skip to content

Commit

Permalink
fix set globalbase pointer on switch_worker_base()
Browse files Browse the repository at this point in the history
  • Loading branch information
Timur Aitov authored and taitov committed Jan 31, 2024
1 parent c58f828 commit da7e398
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions dataplane/controlplane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1358,16 +1358,16 @@ void cControlPlane::switchGlobalBase()
{
YADECAP_MEMORY_BARRIER_COMPILE;

dataPlane->switch_worker_base();

YADECAP_MEMORY_BARRIER_COMPILE;

{
std::lock_guard<std::mutex> guard(dataPlane->currentGlobalBaseId_mutex);
dataPlane->currentGlobalBaseId ^= 1;
}

YADECAP_MEMORY_BARRIER_COMPILE;

dataPlane->switch_worker_base();

YADECAP_MEMORY_BARRIER_COMPILE;
}

void cControlPlane::waitAllWorkers()
Expand Down
2 changes: 1 addition & 1 deletion dataplane/dataplane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1591,7 +1591,7 @@ void cDataPlane::switch_worker_base()
std::lock_guard<std::mutex> guard(currentGlobalBaseId_mutex);
for (const auto& [socket_id, base_next] : base_nexts)
{
base_next->globalBase = globalBases[socket_id][currentGlobalBaseId ^ 1];
base_next->globalBase = globalBases[socket_id][currentGlobalBaseId];
}
}
neighbor.update_worker_base(base_nexts);
Expand Down

0 comments on commit da7e398

Please sign in to comment.