File tree Expand file tree Collapse file tree 2 files changed +9
-13
lines changed Expand file tree Collapse file tree 2 files changed +9
-13
lines changed Original file line number Diff line number Diff line change @@ -578,10 +578,6 @@ impl<'tcx> ThreadManager<'tcx> {
578578 self . threads [ thread_id] . state . is_terminated ( )
579579 }
580580
581- fn has_blocked_on_epoll ( & self , thread_id : ThreadId ) -> bool {
582- self . threads [ thread_id] . state . is_blocked_on ( BlockReason :: Epoll )
583- }
584-
585581 /// Have all threads terminated?
586582 fn have_all_terminated ( & self ) -> bool {
587583 self . threads . iter ( ) . all ( |thread| thread. state . is_terminated ( ) )
@@ -1141,12 +1137,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
11411137 this. machine . threads . enable_thread ( thread_id) ;
11421138 }
11431139
1144- #[ inline]
1145- fn has_blocked_on_epoll ( & self , thread_id : ThreadId ) -> bool {
1146- let this = self . eval_context_ref ( ) ;
1147- this. machine . threads . has_blocked_on_epoll ( thread_id)
1148- }
1149-
11501140 #[ inline]
11511141 fn active_thread_stack < ' a > ( & ' a self ) -> & ' a [ Frame < ' tcx , Provenance , FrameExtra < ' tcx > > ] {
11521142 let this = self . eval_context_ref ( ) ;
Original file line number Diff line number Diff line change @@ -509,6 +509,14 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
509509 }
510510 @timeout = |this| {
511511 // No notification after blocking timeout.
512+ let Some ( epfd) = weak_epfd. upgrade( ) else {
513+ throw_unsup_format!( "epoll FD {epfd_value} got closed while blocking." )
514+ } ;
515+ // Remove the current active thread_id from the blocked thread_id list.
516+ epfd. downcast:: <Epoll >( )
517+ . ok_or_else( || err_unsup_format!( "non-epoll FD passed to `epoll_wait`" ) ) ?
518+ . thread_id. borrow_mut( )
519+ . retain( |& id| id != this. active_thread( ) ) ;
512520 this. write_int( 0 , & dest) ?;
513521 Ok ( ( ) )
514522 }
@@ -605,9 +613,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
605613 waiter. sort ( ) ;
606614 waiter. dedup ( ) ;
607615 for thread_id in waiter {
608- if this. has_blocked_on_epoll ( thread_id) {
609- this. unblock_thread ( thread_id, BlockReason :: Epoll ) ?;
610- }
616+ this. unblock_thread ( thread_id, BlockReason :: Epoll ) ?;
611617 }
612618 Ok ( ( ) )
613619 }
You can’t perform that action at this time.
0 commit comments