@@ -30,15 +30,15 @@ I jtmdif(struct jtimespec w){
3030 R (w .tv_sec - t .tv_sec )* 1000000000ull + w .tv_nsec - t .tv_nsec ;}
3131
3232#if PYXES
33- #ifdef __APPLE__
33+ #if defined( __APPLE__ )
3434void jfutex_wake1 (UI4 * p ){__ulock_wake (UL_COMPARE_AND_WAIT |ULF_NO_ERRNO ,p ,0 );}
3535void jfutex_wakea (UI4 * p ){__ulock_wake (UL_COMPARE_AND_WAIT |ULF_NO_ERRNO |ULF_WAKE_ALL ,p ,0 );}
3636C jfutex_wait (UI4 * p ,UI4 v ){
3737 I r = __ulock_wait (UL_COMPARE_AND_WAIT |ULF_NO_ERRNO ,p ,v ,0 );
3838 if (r >=0 )R 0 ;
3939 if (r == - EINTR || r == - EFAULT )R 0 ; //EFAULT means the address needed to be paged in, not that it wasn't mapped?
4040 R EVFACE ;} //should never happen?
41- #if __arm64__
41+ #if defined( __arm64__ ) || defined( __aarch64__ )
4242// wait2 takes an ns timeout, but it's only available from macos 11 onward; coincidentally, arm macs only support macos 11+
4343// so we can count on having this
4444I jfutex_waitn (UI4 * p ,UI4 v ,UI ns ){
@@ -65,8 +65,10 @@ I jfutex_waitn(UI4 *p,UI4 v,UI ns){I r;
6565 if (r == - ENOMEM )R EVWSFULL ;
6666 R EVFACE ;}
6767#endif
68- #elif defined(__linux__ )
68+ #elif defined(__linux__ )&& !defined( ANDROID )
6969//glibc 'syscall': stupid errno
70+ // ??? asm applicable to arm64
71+ // #if defined(__x86_64__)||defined(__i386__)||defined(_M_X64)||defined(_M_IX86)
7072void jfutex_wake1 (UI4 * p ){
7173 __asm__ volatile ("syscall" :: "a" (SYS_futex ), //eax: syscall#
7274 "D" (p ), //rdi: ptr
@@ -102,6 +104,8 @@ I jfutex_waitn(UI4 *p,UI4 v,UI ns){
102104 if (r == - ETIMEDOUT )R - 1 ;
103105 if (r == - EAGAIN || r == - EINTR )R 0 ;
104106 R EVFACE ;}
107+ #elif defined(ANDROID )
108+ // TODO
105109#elif defined(_WIN32 )
106110// defined in cd.c to avoid name collisions between j.h and windows.h
107111#endif
0 commit comments