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:
Thad House
2016-06-05 07:29:47 -07:00
committed by Peter Johnson
parent 8527f2c2a1
commit 776a991d61
13 changed files with 197 additions and 176 deletions

View File

@@ -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