Kernel: Semaphores and Threads can now be blocked with timeout
This commit is contained in:
@@ -155,7 +155,7 @@ namespace Kernel
|
||||
|
||||
if (!pending.has_value())
|
||||
{
|
||||
m_pending_semaphore.block();
|
||||
m_pending_semaphore.block_indefinite();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -239,7 +239,7 @@ namespace Kernel
|
||||
|
||||
if (!pending.has_value())
|
||||
{
|
||||
m_pending_semaphore.block();
|
||||
m_pending_semaphore.block_indefinite();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Kernel
|
||||
BAN::ErrorOr<size_t> UDPSocket::read_packet(BAN::ByteSpan buffer, sockaddr_in* sender_addr)
|
||||
{
|
||||
while (m_packets.empty())
|
||||
TRY(Thread::current().block_or_eintr(m_packet_semaphore));
|
||||
TRY(Thread::current().block_or_eintr_indefinite(m_packet_semaphore));
|
||||
|
||||
LockGuard _(m_packet_lock);
|
||||
if (m_packets.empty())
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace Kernel
|
||||
return BAN::Error::from_errno(EINVAL);
|
||||
|
||||
while (connection_info.pending_connections.empty())
|
||||
TRY(Thread::current().block_or_eintr(connection_info.pending_semaphore));
|
||||
TRY(Thread::current().block_or_eintr_indefinite(connection_info.pending_semaphore));
|
||||
|
||||
BAN::RefPtr<UnixDomainSocket> pending;
|
||||
|
||||
@@ -158,7 +158,7 @@ namespace Kernel
|
||||
break;
|
||||
}
|
||||
}
|
||||
TRY(Thread::current().block_or_eintr(target_info.pending_semaphore));
|
||||
TRY(Thread::current().block_or_eintr_indefinite(target_info.pending_semaphore));
|
||||
}
|
||||
|
||||
while (!connection_info.connection_done)
|
||||
@@ -234,7 +234,7 @@ namespace Kernel
|
||||
while (m_packet_sizes.full() || m_packet_size_total + packet.size() > s_packet_buffer_size)
|
||||
{
|
||||
LockFreeGuard _(m_lock);
|
||||
TRY(Thread::current().block_or_eintr(m_packet_semaphore));
|
||||
TRY(Thread::current().block_or_eintr_indefinite(m_packet_semaphore));
|
||||
}
|
||||
|
||||
uint8_t* packet_buffer = reinterpret_cast<uint8_t*>(m_packet_buffer->vaddr() + m_packet_size_total);
|
||||
@@ -321,7 +321,7 @@ namespace Kernel
|
||||
while (m_packet_size_total == 0)
|
||||
{
|
||||
LockFreeGuard _(m_lock);
|
||||
TRY(Thread::current().block_or_eintr(m_packet_semaphore));
|
||||
TRY(Thread::current().block_or_eintr_indefinite(m_packet_semaphore));
|
||||
}
|
||||
|
||||
uint8_t* packet_buffer = reinterpret_cast<uint8_t*>(m_packet_buffer->vaddr());
|
||||
|
||||
Reference in New Issue
Block a user