File tree 1 file changed +17
-1
lines changed
1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 15
15
// You should have received a copy of the GNU General Public License
16
16
// along with Aero. If not, see <https://www.gnu.org/licenses/>.
17
17
18
+ // TODO: The reason why XFE did not run was because of the FXSleep function which uses select() to
19
+ // sleep.
20
+
18
21
use aero_syscall:: prelude:: { EPollEvent , EPollEventFlags } ;
19
22
use aero_syscall:: SyscallError ;
20
23
@@ -170,7 +173,7 @@ impl EPoll {
170
173
}
171
174
172
175
// If all events are ready, we can return now.
173
- if n > 0 {
176
+ if n > 0 || fds . is_empty ( ) {
174
177
debug_assert ! ( fds. is_empty( ) ) ;
175
178
return Ok ( n) ;
176
179
}
@@ -181,9 +184,22 @@ impl EPoll {
181
184
return Ok ( 0 ) ;
182
185
}
183
186
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
+
184
195
' search: loop {
185
196
scheduler:: get_scheduler ( ) . inner . await_io ( ) ?;
186
197
198
+ if current_task. load_sleep_duration ( ) == 0 && timeout > 0 {
199
+ // Timeout has expired.
200
+ return Ok ( 0 ) ;
201
+ }
202
+
187
203
for ( fd, event, flags) in fds. iter_mut ( ) {
188
204
// If the event mask does not contain any poll(2) events, the event
189
205
// descriptor is disabled.
You can’t perform that action at this time.
0 commit comments