Return error in case chaining fails

pull/9066/head
deepikabhavnani 2018-12-13 12:19:33 -06:00
parent 03853597f5
commit 87c557c288
2 changed files with 7 additions and 5 deletions

View File

@ -16,7 +16,6 @@
*/ */
#include "events/EventQueue.h" #include "events/EventQueue.h"
#include "events/mbed_events.h" #include "events/mbed_events.h"
#include "platform/mbed_assert.h"
using mbed::Callback; using mbed::Callback;
@ -72,12 +71,12 @@ void EventQueue::background(Callback<void(int)> update)
} }
} }
void EventQueue::chain(EventQueue *target) int EventQueue::chain(EventQueue *target)
{ {
if (target) { if (target) {
MBED_ASSERT(equeue_chain(&_equeue, &target->_equeue) == 0); return equeue_chain(&_equeue, &target->_equeue);
} else { } else {
MBED_ASSERT(equeue_chain(&_equeue, 0) == 0); return equeue_chain(&_equeue, 0);
} }
} }
} }

View File

@ -181,8 +181,11 @@ public:
* *
* @param target Queue that will dispatch this queue's events as a * @param target Queue that will dispatch this queue's events as a
* part of its dispatch loop * part of its dispatch loop
*
* @return Zero on success and negative error code value if chaining fails
*
*/ */
void chain(EventQueue *target); int chain(EventQueue *target);