Unverified Commit 971c235e authored by Earle F. Philhower, III's avatar Earle F. Philhower, III Committed by GitHub

Remove unneeded intermediate async for Ethernet (#1864)

Remove the always pending worker whose job it was to fire another async
worker after a timeout.
parent abd35477
......@@ -31,7 +31,6 @@ bool __ethernetContextInitted = false;
// Async context that pumps the ethernet controllers
static async_context_threadsafe_background_t lwip_ethernet_async_context_threadsafe_background;
static async_when_pending_worker_t always_pending_update_timeout_worker;
static async_at_time_worker_t ethernet_timeout_worker;
static async_context_t *_context = nullptr;
......@@ -129,8 +128,9 @@ static async_context_t *lwip_ethernet_init_default_async_context(void) {
return NULL;
}
static uint32_t _pollingPeriod = 20;
// This will only be called under the protection of the async context mutex, so no re-entrancy checks needed
static void ethernet_timeout_reached(__unused async_context_t *context, __unused async_at_time_worker_t *worker) {
static void ethernet_timeout_reached(async_context_t *context, __unused async_at_time_worker_t *worker) {
assert(worker == &ethernet_timeout_worker);
for (auto handlePacket : _handlePacketList) {
handlePacket.second();
......@@ -142,12 +142,6 @@ static void ethernet_timeout_reached(__unused async_context_t *context, __unused
#else
sys_check_timeouts();
#endif
}
static uint32_t _pollingPeriod = 20;
static void update_next_timeout(async_context_t *context, async_when_pending_worker_t *worker) {
assert(worker == &always_pending_update_timeout_worker);
worker->work_pending = true;
async_context_add_at_time_worker_in_ms(context, &ethernet_timeout_worker, _pollingPeriod);
}
......@@ -164,10 +158,8 @@ void __startEthernetContext() {
#else
_context = lwip_ethernet_init_default_async_context();
#endif
always_pending_update_timeout_worker.work_pending = true;
always_pending_update_timeout_worker.do_work = update_next_timeout;
ethernet_timeout_worker.do_work = ethernet_timeout_reached;
async_context_add_when_pending_worker(_context, &always_pending_update_timeout_worker);
async_context_add_at_time_worker_in_ms(_context, &ethernet_timeout_worker, _pollingPeriod);
__ethernetContextInitted = true;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment