|
@@ -98,9 +98,10 @@ void addSubscriber(events_t *event, void (*handler)(event_t *)) {
|
|
* Adds a subscriber to an event
|
|
* Adds a subscriber to an event
|
|
* @param event Target event name
|
|
* @param event Target event name
|
|
* @param handler Event handler
|
|
* @param handler Event handler
|
|
|
|
+ * @param subscriber name of the subscribing process
|
|
*/
|
|
*/
|
|
|
|
|
|
-void event_subscribe(const char *event, void (*handler)(event_t *)) {
|
|
|
|
|
|
+void event_subscribe(const char *event, void (*handler)(event_t *), const char *subscriber) {
|
|
subscribeMutex.lock();
|
|
subscribeMutex.lock();
|
|
events_t * subscribeEvent = event_find(event);
|
|
events_t * subscribeEvent = event_find(event);
|
|
if(!subscribeEvent){//create new Event
|
|
if(!subscribeEvent){//create new Event
|
|
@@ -117,7 +118,7 @@ void event_subscribe(const char *event, void (*handler)(event_t *)) {
|
|
firstEvent = subscribeEvent;
|
|
firstEvent = subscribeEvent;
|
|
}
|
|
}
|
|
addSubscriber(subscribeEvent, handler);
|
|
addSubscriber(subscribeEvent, handler);
|
|
- logger(V_HAL, "New subscriber to event \"%s\"\n", event);
|
|
|
|
|
|
+ logger(V_HAL, "%s subscribed to event \"%s\"\n", subscriber, event);
|
|
subscribeMutex.unlock();
|
|
subscribeMutex.unlock();
|
|
}
|
|
}
|
|
|
|
|