Some more network changes.

This commit is contained in:
OBattler
2022-02-20 02:00:23 +01:00
parent 4d56f89fb2
commit b4c1e801c5
3 changed files with 17 additions and 8 deletions

View File

@@ -183,8 +183,10 @@ poll_thread(void *arg)
/* Wait for a poll request. */ /* Wait for a poll request. */
network_poll(); network_poll();
if (pcap == NULL) if (pcap == NULL) {
network_wait(0);
break; break;
}
if (network_get_wait() || (poll_card->set_link_state && poll_card->set_link_state(poll_card->priv)) || (poll_card->wait && poll_card->wait(poll_card->priv))) if (network_get_wait() || (poll_card->set_link_state && poll_card->set_link_state(poll_card->priv)) || (poll_card->wait && poll_card->wait(poll_card->priv)))
data = NULL; data = NULL;
@@ -213,12 +215,12 @@ poll_thread(void *arg)
if (tx) if (tx)
network_do_tx(); network_do_tx();
/* Release ownership of the device. */
network_wait(0);
/* If we did not get anything, wait a while. */ /* If we did not get anything, wait a while. */
if (!tx) if (!tx)
thread_wait_event(evt, 10); thread_wait_event(evt, 10);
/* Release ownership of the device. */
network_wait(0);
} }
/* No longer needed. */ /* No longer needed. */

View File

@@ -366,7 +366,10 @@ poll_thread(void *arg)
network_poll(); network_poll();
/* Stop processing if asked to. */ /* Stop processing if asked to. */
if (slirp->stop) break; if (slirp->stop) {
network_wait(0);
break;
}
/* See if there is any work. */ /* See if there is any work. */
slirp_tic(slirp); slirp_tic(slirp);
@@ -377,12 +380,12 @@ poll_thread(void *arg)
if (tx) if (tx)
network_do_tx(); network_do_tx();
/* Release ownership of the queue. */
network_wait(0);
/* If we did not get anything, wait a while. */ /* If we did not get anything, wait a while. */
if (!tx) if (!tx)
thread_wait_event(evt, 10); thread_wait_event(evt, 10);
/* Release ownership of the queue. */
network_wait(0);
} }
/* No longer needed. */ /* No longer needed. */

View File

@@ -204,9 +204,13 @@ network_wait(uint8_t wait)
void void
network_poll(void) network_poll(void)
{ {
network_wait(0);
while (poll_data.busy) while (poll_data.busy)
thread_wait_event(poll_data.wake_poll_thread, -1); thread_wait_event(poll_data.wake_poll_thread, -1);
network_wait(1);
thread_reset_event(poll_data.wake_poll_thread); thread_reset_event(poll_data.wake_poll_thread);
} }