mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Make Sendable setters synchronous (#1799)
Instead of being called asynchronously by NetworkTables, they are now called by updateValues() synchronously with the main loop, just like the getters.
This commit is contained in:
@@ -254,10 +254,17 @@ std::shared_ptr<nt::Value> SmartDashboard::GetValue(wpi::StringRef keyName) {
|
||||
return Singleton::GetInstance().table->GetEntry(keyName).GetValue();
|
||||
}
|
||||
|
||||
detail::ListenerExecutor SmartDashboard::listenerExecutor;
|
||||
|
||||
void SmartDashboard::PostListenerTask(std::function<void()> task) {
|
||||
listenerExecutor.Execute(task);
|
||||
}
|
||||
|
||||
void SmartDashboard::UpdateValues() {
|
||||
auto& inst = Singleton::GetInstance();
|
||||
std::scoped_lock lock(inst.tablesToDataMutex);
|
||||
for (auto& i : inst.tablesToData) {
|
||||
i.getValue().builder.UpdateTable();
|
||||
}
|
||||
listenerExecutor.RunListenerTasks();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user