@@ -14,23 +14,6 @@ NOINLINE I johnson(I n){I johnson=0x1234; if(n<0)R n; do{johnson ^= (johnson<<1)
1414//36ns TUNE; ~60clk on zen, ~160clk on intel; consider adding more general uarch tuning capabilities (eg for cache size)
1515//7ns mispredict penalty (15-20clk) + mul latency (3clk)
1616
17- #if SY_WIN32
18- struct timezone {
19- int tz_minuteswest ;
20- int tz_dsttime ;
21- };
22-
23- // Tip o'hat to Michaelangel007 on StackOverflow
24- // MSVC defines this in winsock2.h!?
25- typedef struct timeval {
26- long tv_sec ;
27- long tv_usec ;
28- } timeval ;
29- extern int gettimeofday (struct timeval * tp , struct timezone * tzp );
30- #else
31- #include <sys/time.h>
32- #endif
33-
3417// Extend a hashtable/data table under lock. abuf is the pointer to the block to be extended (*abuf will hold the new block address).
3518// *alock is the lock to use. We hold a writelock on *alock on entry, but we may relinquish inside this routine.
3619// On exit we hold the write lock UNLESS there was an error, in which case we return NOT holding the lock (to allow the caller to abort on error)
@@ -241,8 +224,8 @@ A jtpyxval(J jt,A pyx){A res; C errcode;
241224 if (unlikely (maxtime < tod ())){errcode = EVTIME ; break ;} // timeout: fail the pyx and exit
242225 pthread_mutex_lock (& ((PYXBLOK * )AAV0 (pyx ))-> pyxwb .mutex );
243226 if ((res = __atomic_load_n (& ((PYXBLOK * )AAV0 (pyx ))-> pyxvalue ,__ATOMIC_ACQUIRE ))== 0 && (errcode = __atomic_load_n (& ((PYXBLOK * )AAV0 (pyx ))-> errcode ,__ATOMIC_ACQUIRE ))== 0 ){
244- struct timeval nowtime ;
245- gettimeofday (& nowtime ,0 ); // system time now
227+ struct jtimeval nowtime ;
228+ jgettimeofday (& nowtime ,0 ); // system time now
246229 I tousec = nowtime .tv_usec + 200000 ;
247230 struct timespec endtime = {nowtime .tv_usec + (tousec >=1000000 ),tousec - 1000000 * (tousec >=1000000 )}; // system time when we give up. The struct says it uses nsec but it seems to use usec
248231 pthread_cond_timedwait (& ((PYXBLOK * )AAV0 (pyx ))-> pyxwb .cond ,& ((PYXBLOK * )AAV0 (pyx ))-> pyxwb .mutex ,& endtime );
0 commit comments