@@ -363,7 +363,6 @@ impl Thread {
363363 #[ cfg( target_vendor = "apple" ) ]
364364 pub fn sleep_until ( deadline : crate :: time:: Instant ) {
365365 use core:: mem:: MaybeUninit ;
366-
367366 use super :: time:: Timespec ;
368367
369368 let Timespec { tv_sec, tv_nsec } = deadline. into_inner ( ) . into_timespec ( ) ;
@@ -379,14 +378,14 @@ impl Thread {
379378
380379 loop {
381380 // 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
384383 let ret = mach_wait_until ( ticks) ;
385- if ret != KERN_ABORTED {
384+ if ret == KERN_SUCCESS {
386385 break ;
387386 }
387+ assert_eq ! ( KERN_ABORTED , "mach_wait_until returned error, code: {ret}" ) ;
388388 }
389- assert_eq ! ( ret, KERN_SUCCESS ) ;
390389 }
391390 }
392391
@@ -405,13 +404,13 @@ impl Thread {
405404 }
406405}
407406
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
410408#[ cfg( target_vendor = "apple" ) ]
411409const KERN_SUCCESS : libc:: c_int = 0 ;
412410#[ cfg( target_vendor = "apple" ) ]
413411const KERN_ABORTED : libc:: c_int = 14 ;
414412
413+ // See https://github.com/apple-oss-distributions/xnu/blob/94d3b452840153a99b38a3a9659680b2a006908e/osfmk/mach/mach_time.h
415414#[ cfg( target_vendor = "apple" ) ]
416415#[ repr( C ) ]
417416struct mach_timebase_info_type {
0 commit comments