-
Notifications
You must be signed in to change notification settings - Fork 14
Labels
in progressthis issue is currently being worked onthis issue is currently being worked on
Description
Overview
The VDML (AKA Vex Data Management Layer) ensures thread safety when interacting with devices from multiple threads. However, the decision to write it in C was a poor design choice. It should be written in C++ to avoid the use of macros.
Motivation
Maintaining device implementations is unnecessarily difficult currently.
Potential Implementation
// vdml.cpp
#include "vdml.hpp"
namespace vdml {
static constinit std::array<std::mutex, 21> array;
std::mutex& get_smart_port_mutex(uint8_t port) {
return array.at(port - 1);
}
} // namespace vdml// motor.cpp
#include "Motor.hpp"
#include "vdml.hpp"
namespace zest {
void Motor::move(double power) {
const std::lock_guard lock(vdml::get_smart_port_mutex(m_port));
// ...
}
} // namespace zestSub-issues
Metadata
Metadata
Assignees
Labels
in progressthis issue is currently being worked onthis issue is currently being worked on