mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 01:47:36 +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:
parent
e8d61bb8c0
commit
b2e502e533
8 changed files with 22 additions and 78 deletions
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue