mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
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:
committed by
Peter Johnson
parent
0f6ef80ab2
commit
dde61aad32
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user