|
|
|
|
@ -984,6 +984,13 @@ void uasync_poll(struct UASYNC* ua, int timeout_tb) {
|
|
|
|
|
if (!ua) return; |
|
|
|
|
if (!ua->sockets || !ua->timeout_heap) return; |
|
|
|
|
|
|
|
|
|
uint64_t now_us_poll_entry = get_time_us(); |
|
|
|
|
if (ua->last_poll_entry_us && now_us_poll_entry - ua->last_poll_entry_us > 10000) { |
|
|
|
|
DEBUG_WARN(DEBUG_CATEGORY_UASYNC, "Event loop stall: %lluus since last poll entry", |
|
|
|
|
(unsigned long long)(now_us_poll_entry - ua->last_poll_entry_us)); |
|
|
|
|
} |
|
|
|
|
ua->last_poll_entry_us = now_us_poll_entry; |
|
|
|
|
|
|
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_UASYNC, "poll(%d sockets, %zu timers, timeout=%d.%dms)", |
|
|
|
|
ua->sockets->count, ua->timeout_heap->size, timeout_tb >= 0 ? timeout_tb / 10000 : -1, |
|
|
|
|
timeout_tb >= 0 ? (timeout_tb % 10000) / 10 : 0);
|
|
|
|
|
@ -1320,6 +1327,7 @@ struct UASYNC* uasync_create(void) {
|
|
|
|
|
ua->posted_tasks_head = NULL; |
|
|
|
|
ua->immediate_queue_head = NULL; |
|
|
|
|
ua->immediate_queue_tail = NULL; |
|
|
|
|
ua->last_poll_entry_us = 0; |
|
|
|
|
|
|
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "Creating SA..."); |
|
|
|
|
ua->sockets = socket_array_create(16); |
|
|
|
|
|