We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f89655f commit db4b02cCopy full SHA for db4b02c
events/source/EventQueue.cpp
@@ -83,12 +83,18 @@ int EventQueue::time_left(int id)
83
84
void EventQueue::background(Callback<void(int)> update)
85
{
86
+ // Start by setting the background callback to nullptr
87
+ // as equeue_background calls the existing handler with a timeout
88
+ // of -1 to indicate to the callback that the tineout process is
89
+ // not further required.
90
+ // Updating _update before would prevent calling into the
91
+ // old callback as the callbacks share the same memory locations.
92
+ equeue_background(&_equeue, 0, 0);
93
+
94
_update = update;
95
96
if (_update) {
97
equeue_background(&_equeue, &Callback<void(int)>::thunk, &_update);
- } else {
- equeue_background(&_equeue, 0, 0);
98
}
99
100
0 commit comments