Remove TimerEventHandler typedef from Notifier class (#1767)

Using std::function<void()> directly makes it much clearer to the user
what kind of function Notifier expects. The Doxygen comments already say
what the function is used for, so the typedef just discards useful
information.
This commit is contained in:
Tyler Veness
2019-07-20 22:57:16 -07:00
committed by Peter Johnson
parent 0f6ef80ab2
commit dde61aad32
2 changed files with 7 additions and 9 deletions

View File

@@ -17,7 +17,7 @@
using namespace frc;
Notifier::Notifier(TimerEventHandler handler) {
Notifier::Notifier(std::function<void()> handler) {
if (handler == nullptr)
wpi_setWPIErrorWithContext(NullParameter, "handler must not be nullptr");
m_handler = handler;
@@ -33,7 +33,7 @@ Notifier::Notifier(TimerEventHandler handler) {
uint64_t curTime = HAL_WaitForNotifierAlarm(notifier, &status);
if (curTime == 0 || status != 0) break;
TimerEventHandler handler;
std::function<void()> handler;
{
std::scoped_lock lock(m_processMutex);
handler = m_handler;
@@ -90,7 +90,7 @@ Notifier& Notifier::operator=(Notifier&& rhs) {
return *this;
}
void Notifier::SetHandler(TimerEventHandler handler) {
void Notifier::SetHandler(std::function<void()> handler) {
std::scoped_lock lock(m_processMutex);
m_handler = handler;
}