File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 1515// You should have received a copy of the GNU General Public License
1616// along with Aero. If not, see <https://www.gnu.org/licenses/>.
1717
18+ // TODO: The reason why XFE did not run was because of the FXSleep function which uses select() to
19+ // sleep.
20+
1821use aero_syscall:: prelude:: { EPollEvent , EPollEventFlags } ;
1922use aero_syscall:: SyscallError ;
2023
@@ -170,7 +173,7 @@ impl EPoll {
170173 }
171174
172175 // If all events are ready, we can return now.
173- if n > 0 {
176+ if n > 0 || fds . is_empty ( ) {
174177 debug_assert ! ( fds. is_empty( ) ) ;
175178 return Ok ( n) ;
176179 }
@@ -181,9 +184,22 @@ impl EPoll {
181184 return Ok ( 0 ) ;
182185 }
183186
187+ if timeout > 0 {
188+ scheduler:: get_scheduler ( )
189+ . inner
190+ . sleep ( Some ( timeout * 1_000_000 ) ) ?;
191+ } else {
192+ scheduler:: get_scheduler ( ) . inner . sleep ( None ) ?;
193+ }
194+
184195 ' search: loop {
185196 scheduler:: get_scheduler ( ) . inner . await_io ( ) ?;
186197
198+ if current_task. load_sleep_duration ( ) == 0 && timeout > 0 {
199+ // Timeout has expired.
200+ return Ok ( 0 ) ;
201+ }
202+
187203 for ( fd, event, flags) in fds. iter_mut ( ) {
188204 // If the event mask does not contain any poll(2) events, the event
189205 // descriptor is disabled.
You can’t perform that action at this time.
0 commit comments