@@ -31,7 +31,6 @@ bool __ethernetContextInitted = false;
31
31
32
32
// Async context that pumps the ethernet controllers
33
33
static async_context_threadsafe_background_t lwip_ethernet_async_context_threadsafe_background;
34
- static async_when_pending_worker_t always_pending_update_timeout_worker;
35
34
static async_at_time_worker_t ethernet_timeout_worker;
36
35
37
36
static async_context_t *_context = nullptr ;
@@ -129,8 +128,9 @@ static async_context_t *lwip_ethernet_init_default_async_context(void) {
129
128
return NULL ;
130
129
}
131
130
131
+ static uint32_t _pollingPeriod = 20 ;
132
132
// This will only be called under the protection of the async context mutex, so no re-entrancy checks needed
133
- static void ethernet_timeout_reached (__unused async_context_t *context, __unused async_at_time_worker_t *worker) {
133
+ static void ethernet_timeout_reached (async_context_t *context, __unused async_at_time_worker_t *worker) {
134
134
assert (worker == ðernet_timeout_worker);
135
135
for (auto handlePacket : _handlePacketList) {
136
136
handlePacket.second ();
@@ -142,12 +142,6 @@ static void ethernet_timeout_reached(__unused async_context_t *context, __unused
142
142
#else
143
143
sys_check_timeouts ();
144
144
#endif
145
- }
146
-
147
- static uint32_t _pollingPeriod = 20 ;
148
- static void update_next_timeout (async_context_t *context, async_when_pending_worker_t *worker) {
149
- assert (worker == &always_pending_update_timeout_worker);
150
- worker->work_pending = true ;
151
145
async_context_add_at_time_worker_in_ms (context, ðernet_timeout_worker, _pollingPeriod);
152
146
}
153
147
@@ -164,10 +158,8 @@ void __startEthernetContext() {
164
158
#else
165
159
_context = lwip_ethernet_init_default_async_context ();
166
160
#endif
167
- always_pending_update_timeout_worker.work_pending = true ;
168
- always_pending_update_timeout_worker.do_work = update_next_timeout;
169
161
ethernet_timeout_worker.do_work = ethernet_timeout_reached;
170
- async_context_add_when_pending_worker (_context, &always_pending_update_timeout_worker );
162
+ async_context_add_at_time_worker_in_ms (_context, ðernet_timeout_worker, _pollingPeriod );
171
163
__ethernetContextInitted = true ;
172
164
}
173
165
0 commit comments