Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/dsl/word/Network.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ namespace dsl {
template <typename DSL>
static std::tuple<std::shared_ptr<NetworkSource>, NetworkData<T>> get(threading::ReactionTask& /*task*/) {

auto* data = store::ThreadStore<std::vector<uint8_t>>::value;
auto* source = store::ThreadStore<NetworkSource>::value;
const auto* data = store::ThreadStore<const std::vector<uint8_t>>::value;
const auto* source = store::ThreadStore<const NetworkSource>::value;

if (data && source) {

Expand Down
20 changes: 10 additions & 10 deletions src/extension/NetworkController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,10 @@ namespace extension {
const bool& reliable,
std::vector<uint8_t>&& payload) {
// Construct our NetworkSource information
dsl::word::NetworkSource src{remote.name, remote.target, reliable};
const dsl::word::NetworkSource src{remote.name, remote.target, reliable};

// Move the payload in as we are stealing it
std::vector<uint8_t> p(std::move(payload));

// Store in our thread local cache
dsl::store::ThreadStore<std::vector<uint8_t>>::value = &p;
dsl::store::ThreadStore<dsl::word::NetworkSource>::value = &src;
const std::vector<uint8_t> p(std::move(payload));

/* Mutex Scope */ {
// Lock our reaction mutex
Expand All @@ -75,13 +71,17 @@ namespace extension {

// Execute on our interested reactions
for (auto it = rs.first; it != rs.second; ++it) {
// Store in our thread local cache
dsl::store::ThreadStore<const std::vector<uint8_t>>::value = &p;
dsl::store::ThreadStore<const dsl::word::NetworkSource>::value = &src;

powerplant.submit(it->second->get_task());
}
}

// Clear our cache
dsl::store::ThreadStore<std::vector<uint8_t>>::value = nullptr;
dsl::store::ThreadStore<dsl::word::NetworkSource>::value = nullptr;
// Clear our cache
dsl::store::ThreadStore<const std::vector<uint8_t>>::value = nullptr;
dsl::store::ThreadStore<const dsl::word::NetworkSource>::value = nullptr;
}
});

// Set our join callback
Expand Down
Loading