Skip to content

Commit fc7aec2

Browse files
committed
add ignore shim
1 parent 845f8d2 commit fc7aec2

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

libs/core/codal.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ void registerWithDal(int id, int event, Action a, int flags) {
102102
registerGCPtr(a);
103103
}
104104

105+
void unregisterFromDal(int id, int event, Action a) {
106+
uBit.messageBus.ignore(id, event, dispatchForeground, a);
107+
decr(a);
108+
unregisterGCPtr(a);
109+
}
110+
105111
void fiberDone(void *a) {
106112
decr((Action)a);
107113
unregisterGCPtr((Action)a);

libs/core/control.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,14 @@ namespace control {
312312
registerWithDal(src, value, handler, (int)flags);
313313
}
314314

315+
/**
316+
* Unregisters an event handler.
317+
*/
318+
//%
319+
void ignoreEvent(int src, int value, Action handler) {
320+
unregisterFromDal(src, value, handler);
321+
}
322+
315323
/**
316324
* Gets the value of the last event executed on the bus
317325
*/

0 commit comments

Comments
 (0)