mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 15:45:25 +00:00
Kernel: Add Thread::block_until(Condition).
Replace the class-based snooze alarm mechanism with a per-thread callback.
This makes it easy to block the current thread on an arbitrary condition:
void SomeDevice::wait_for_irq() {
m_interrupted = false;
current->block_until([this] { return m_interrupted; });
}
void SomeDevice::handle_irq() {
m_interrupted = true;
}
Use this in the SB16 driver, and in NetworkTask :^)
This commit is contained in:
@@ -33,7 +33,6 @@ NetworkAdapter* NetworkAdapter::from_ipv4_address(const IPv4Address& address)
|
||||
}
|
||||
|
||||
NetworkAdapter::NetworkAdapter()
|
||||
: m_packet_queue_alarm(*this)
|
||||
{
|
||||
// FIXME: I wanna lock :(
|
||||
all_adapters().resource().set(this);
|
||||
@@ -106,8 +105,3 @@ void NetworkAdapter::set_interface_name(const StringView& basename)
|
||||
builder.append('0');
|
||||
m_name = builder.to_string();
|
||||
}
|
||||
|
||||
bool PacketQueueAlarm::is_ringing() const
|
||||
{
|
||||
return m_adapter.has_queued_packets();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user