mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 14:07:42 +00:00
Kernel: Use TRY() in FIFO
This commit is contained in:
parent
cad78f5904
commit
c1c774da91
1 changed files with 4 additions and 8 deletions
|
@ -26,11 +26,9 @@ RefPtr<FIFO> FIFO::try_create(UserID uid)
|
||||||
|
|
||||||
KResultOr<NonnullRefPtr<FileDescription>> FIFO::open_direction(FIFO::Direction direction)
|
KResultOr<NonnullRefPtr<FileDescription>> FIFO::open_direction(FIFO::Direction direction)
|
||||||
{
|
{
|
||||||
auto description = FileDescription::try_create(*this);
|
auto description = TRY(FileDescription::try_create(*this));
|
||||||
if (!description.is_error()) {
|
attach(direction);
|
||||||
attach(direction);
|
description->set_fifo_direction({}, direction);
|
||||||
description.value()->set_fifo_direction({}, direction);
|
|
||||||
}
|
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,9 +36,7 @@ KResultOr<NonnullRefPtr<FileDescription>> FIFO::open_direction_blocking(FIFO::Di
|
||||||
{
|
{
|
||||||
MutexLocker locker(m_open_lock);
|
MutexLocker locker(m_open_lock);
|
||||||
|
|
||||||
auto description = open_direction(direction);
|
auto description = TRY(open_direction(direction));
|
||||||
if (description.is_error())
|
|
||||||
return description;
|
|
||||||
|
|
||||||
if (direction == Direction::Reader) {
|
if (direction == Direction::Reader) {
|
||||||
m_read_open_queue.wake_all();
|
m_read_open_queue.wake_all();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue