mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
Moves Notifier over to handles (#97)
Internally, the linked list now uses shared_ptrs instead of raw pointers. In addition, in the WPILib the notifier handle is now made atomic. Then before the class is destructed, the handle is now set to 0. This should help solve one of the existing race conditions. A 0 handle is correctly handled down at the HAL level.
This commit is contained in:
committed by
Peter Johnson
parent
8527f2c2a1
commit
776a991d61
@@ -31,7 +31,9 @@ Notifier::Notifier(TimerEventHandler handler) {
|
||||
*/
|
||||
Notifier::~Notifier() {
|
||||
int32_t status = 0;
|
||||
cleanNotifier(m_notifier, &status);
|
||||
// atomically set handle to 0, then clean
|
||||
HalNotifierHandle handle = m_notifier.exchange(0);
|
||||
cleanNotifier(handle, &status);
|
||||
wpi_setErrorWithContext(status, getHALErrorMessage(status));
|
||||
|
||||
/* Acquire the mutex; this makes certain that the handler is not being
|
||||
|
||||
Reference in New Issue
Block a user