File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -576,9 +576,17 @@ pub fn follow(mut observer: Observer, settings: &Settings) -> UResult<()> {
576576 // Drain any additional pending events to batch them together.
577577 // This prevents redundant headers when multiple inotify events
578578 // are queued (e.g., after resuming from SIGSTOP).
579- while let Ok ( Ok ( event) ) = observer. watcher_rx . as_mut ( ) . unwrap ( ) . receiver . try_recv ( )
580- {
581- process_event ( & mut observer, event, settings, & mut paths) ?;
579+ // Multiple iterations with spin_loop hints give the notify
580+ // background thread chances to deliver pending events.
581+ for _ in 0 ..100 {
582+ while let Ok ( Ok ( event) ) =
583+ observer. watcher_rx . as_mut ( ) . unwrap ( ) . receiver . try_recv ( )
584+ {
585+ process_event ( & mut observer, event, settings, & mut paths) ?;
586+ }
587+ // Use both yield and spin hint for broader CPU support
588+ std:: thread:: yield_now ( ) ;
589+ std:: hint:: spin_loop ( ) ;
582590 }
583591 }
584592 Ok ( Err ( notify:: Error {
You can’t perform that action at this time.
0 commit comments