@@ -363,7 +363,6 @@ impl Thread {
363
363
#[ cfg( target_vendor = "apple" ) ]
364
364
pub fn sleep_until ( deadline : crate :: time:: Instant ) {
365
365
use core:: mem:: MaybeUninit ;
366
-
367
366
use super :: time:: Timespec ;
368
367
369
368
let Timespec { tv_sec, tv_nsec } = deadline. into_inner ( ) . into_timespec ( ) ;
@@ -379,14 +378,14 @@ impl Thread {
379
378
380
379
loop {
381
380
// There are no docs on the mach_wait_until some details can be
382
- // learned from the `Apple OSS Distributions` xnu source code.
383
- // Specifically: xnu/osfmk/clock.h commit 94d3b45 on Github
381
+ // learned from the XNU source code:
382
+ // https://github.com/apple-oss-distributions/ xnu/blob/94d3b452840153a99b38a3a9659680b2a006908e/ osfmk/kern/ clock.c#L1507-L1543
384
383
let ret = mach_wait_until ( ticks) ;
385
- if ret != KERN_ABORTED {
384
+ if ret == KERN_SUCCESS {
386
385
break ;
387
386
}
387
+ assert_eq ! ( KERN_ABORTED , "mach_wait_until returned error, code: {ret}" ) ;
388
388
}
389
- assert_eq ! ( ret, KERN_SUCCESS ) ;
390
389
}
391
390
}
392
391
@@ -405,13 +404,13 @@ impl Thread {
405
404
}
406
405
}
407
406
408
- // these come from the `Apple OSS Distributions` xnu source code.
409
- // Specifically: xnu/osfmk/mach/kern_return.h commit 94d3b45 on Github
407
+ // See https://github.com/apple-oss-distributions/xnu/blob/94d3b452840153a99b38a3a9659680b2a006908e/osfmk/mach/kern_return.h
410
408
#[ cfg( target_vendor = "apple" ) ]
411
409
const KERN_SUCCESS : libc:: c_int = 0 ;
412
410
#[ cfg( target_vendor = "apple" ) ]
413
411
const KERN_ABORTED : libc:: c_int = 14 ;
414
412
413
+ // See https://github.com/apple-oss-distributions/xnu/blob/94d3b452840153a99b38a3a9659680b2a006908e/osfmk/mach/mach_time.h
415
414
#[ cfg( target_vendor = "apple" ) ]
416
415
#[ repr( C ) ]
417
416
struct mach_timebase_info_type {
0 commit comments