Skip to content

Commit

Permalink
Fix: missing mutex
Browse files Browse the repository at this point in the history
  • Loading branch information
ysbaddaden committed Jul 22, 2024
1 parent 9a77bcb commit 2fc2f99
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/crystal/system/unix/epoll/event_loop.cr
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class Crystal::Epoll::EventLoop < Crystal::Evented::EventLoop

Crystal.trace :evloop, "wait", blocking: blocking ? 1 : 0

if blocking && (time = @timers.next_ready?)
if blocking && (time = @mutex.synchronize { @timers.next_ready? })
# epoll_wait only has milliseconds precision, so we use a timerfd for
# timeout; arm it to the next ready time
@timerfd.set(time)
Expand Down Expand Up @@ -192,7 +192,7 @@ class Crystal::Epoll::EventLoop < Crystal::Evented::EventLoop
end

# unsafe, yields when there are no more events for fd
private def system_sync(node : Evented::EventQueue::Node) : Nil
private def system_sync(node : Evented::EventQueue::Node, &) : Nil
events = 0
events |= LibC::EPOLLIN if node.readers?
events |= LibC::EPOLLOUT if node.writers?
Expand Down

0 comments on commit 2fc2f99

Please sign in to comment.