pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:336: Inside #if defined(POSIX_THREADS)
  #endif    pthread_attr_setdetachstate(&small_pattr, PTHREAD_CREATE_DETACHED);   #endif   }      static void cleanup_thread_state (struct thread_state *th);      #ifndef CONFIGURE_TEST      #if defined(HAVE_CLOCK) && \ -  !defined(HAVE_NO_YIELD) && \ +     (defined (HAVE_RDTSC) || \    (!defined(HAVE_GETHRTIME) && \    !(defined(HAVE_MACH_TASK_INFO_H) && defined(TASK_THREAD_TIMES_INFO))))   static clock_t thread_start_clock = 0;   static THREAD_T last_clocked_thread = 0;   #define USE_CLOCK_FOR_SLICES   #endif      #define THIS_THREAD ((struct thread_state *)CURRENT_STORAGE)   
pike.git/src/threads.c:1257: Inside #if defined(HAVE_RDTSC) && defined(USE_CLOCK_FOR_SLICES)
  {   #if defined(HAVE_RDTSC) && defined(USE_CLOCK_FOR_SLICES)    static INT64 tsc_mincycles=1000*1000;   #endif      #ifdef PROFILE_CHECK_THREADS    static unsigned long calls = 0;    calls++;   #endif    - #ifndef HAVE_NO_YIELD -  /* If we have no yield we can't cut calls here since it's possible -  * that a thread switch will take place only occasionally in the -  * window below. */ -  +    #if defined (USE_CLOCK_FOR_SLICES) && defined (PIKE_DEBUG)    if (last_clocked_thread != th_self())    Pike_fatal ("Stale thread %08lx in last_clocked_thread (self is %08lx)\n",    (unsigned long) last_clocked_thread, (unsigned long) th_self());   #endif      #if defined(HAVE_RDTSC) && defined(USE_CLOCK_FOR_SLICES)    /* We can get here as often as 30+ thousand times per second;    let's try to avoid doing as many clock(3)/times(2) syscalls    by using the TSC. We'll skip any further checks until the
pike.git/src/threads.c:1391:    }    }   #elif defined (USE_CLOCK_FOR_SLICES)    if (clock() - thread_start_clock < (clock_t) (CLOCKS_PER_SEC / 20))    return;   #else    static int div_;    if(div_++ & 255)    return;   #endif - #endif +        do_yield:;      #ifdef PROFILE_CHECK_THREADS    {    static long last_time;    struct timeval now;    gettimeofday (&now, NULL);    if (now.tv_sec > last_time) {    fprintf (stderr, "check_threads calls in %ld sec(s): %lu "