mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-02 22:55:23 +00:00
Kernel: Snooze the NetworkTask until there are incoming packets to process.
This is accomplished using a new Alarm class and a BlockedSnoozing state. Basically, you call Process::snooze_until(some_alarm) and then the scheduler won't wake up the process until some_alarm.is_ringing() returns true.
This commit is contained in:
@@ -25,6 +25,7 @@ NetworkAdapter* NetworkAdapter::from_ipv4_address(const IPv4Address& address)
|
||||
}
|
||||
|
||||
NetworkAdapter::NetworkAdapter()
|
||||
: m_packet_queue_alarm(*this)
|
||||
{
|
||||
// FIXME: I wanna lock :(
|
||||
ASSERT_INTERRUPTS_DISABLED();
|
||||
@@ -90,3 +91,8 @@ void NetworkAdapter::set_ipv4_address(const IPv4Address& address)
|
||||
{
|
||||
m_ipv4_address = address;
|
||||
}
|
||||
|
||||
bool PacketQueueAlarm::is_ringing() const
|
||||
{
|
||||
return m_adapter.has_queued_packets();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user