pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:52: Inside #if defined(HAVE_TIME_H)
  #endif   #ifdef HAVE_TIME_H   #include <time.h>   #endif      /* This is used for strapping the interpreter before the threads    * are loaded, and when there's no support for threads.    */   static struct Pike_interpreter_struct static_pike_interpreter;    - PMOD_EXPORT struct Pike_interpreter_struct *Pike_interpreter_pointer = -  &static_pike_interpreter; + PMOD_EXPORT struct Pike_interpreter_struct * + #if defined(__GNUC__) && __GNUC__ >= 3 +  __restrict + #endif + Pike_interpreter_pointer = &static_pike_interpreter;      PMOD_EXPORT struct Pike_interpreter_struct * pike_get_interpreter_pointer(void)   {    return Pike_interpreter_pointer;   }   #else /* CONFIGURE_TEST */   #include "pike_threadlib.h"   #endif      #ifndef VERBOSE_THREADS_DEBUG
pike.git/src/threads.c:350: Inside #if defined(POSIX_THREADS)
   pthread_attr_setstacksize(&small_pattr, 4096*sizeof(char *));   #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 (RDTSC) || \ + #if defined (RDTSC) || \    (!defined(HAVE_GETHRTIME) && \ -  !(defined(HAVE_MACH_TASK_INFO_H) && defined(TASK_THREAD_TIMES_INFO)))) +  !(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   #ifdef RDTSC   static int use_tsc_for_slices;   #define TSC_START_INTERVAL 100000   static INT64 prev_tsc; /* TSC and */   static clock_t prev_clock; /* clock() at the beg of the last tsc interval */   #endif   #endif
pike.git/src/threads.c:2091:    struct mutex_storage *m;    struct object *o;    INT_TYPE type;       DEBUG_CHECK_THREAD();       m=THIS_MUTEX;    if(!args)    type=0;    else -  get_all_args("mutex->lock",args,"%i",&type); +  get_all_args("lock",args,"%i",&type);       switch(type)    {    default: -  bad_arg_error("mutex->lock", Pike_sp-args, args, 2, "int(0..2)", Pike_sp+1-args, +  bad_arg_error("lock", Pike_sp-args, args, 2, "int(0..2)", Pike_sp+1-args,    "Unknown mutex locking style: %"PRINTPIKEINT"d\n",type);          case 0:    case 2:    if(m->key && OB2KEY(m->key)->owner == Pike_interpreter.thread_state)    {    THREADS_FPRINTF(0,    (stderr, "Recursive LOCK k:%p, m:%p(%p), t:%p\n",    OB2KEY(m->key), m, OB2KEY(m->key)->mut,
pike.git/src/threads.c:2193:       /* No reason to release the interpreter lock here    * since we aren't calling any functions that take time.    */       m=THIS_MUTEX;       if(!args)    type=0;    else -  get_all_args("mutex->trylock",args,"%i",&type); +  get_all_args("trylock",args,"%i",&type);       switch(type)    {    default: -  bad_arg_error("mutex->trylock", Pike_sp-args, args, 2, "int(0..2)", Pike_sp+1-args, +  bad_arg_error("trylock", Pike_sp-args, args, 2, "int(0..2)", Pike_sp+1-args,    "Unknown mutex locking style: %"PRINTPIKEINT"d\n",type);       case 0:    if(m->key && OB2KEY(m->key)->owner == Pike_interpreter.thread_state)    {    Pike_error("Recursive mutex locks!\n");    }       case 2:    case 1:
pike.git/src/threads.c:2495:    struct object *key, *mutex_obj;    struct mutex_storage *mut;    struct pike_cond *c;    INT_TYPE seconds = 0, nanos = 0;       if(threads_disabled)    Pike_error("Cannot wait for conditions when threads are disabled!\n");       if (args <= 2) {    FLOAT_TYPE fsecs = 0.0; -  get_all_args("condition->wait", args, "%o.%F", &key, &fsecs); +  get_all_args("wait", args, "%o.%F", &key, &fsecs);    seconds = (INT_TYPE) fsecs;    nanos = (INT_TYPE)((fsecs - seconds)*1000000000);    } else {    /* FIXME: Support bignum nanos. */ -  get_all_args("condition->wait", args, "%o%i%i", &key, &seconds, &nanos); +  get_all_args("wait", args, "%o%i%i", &key, &seconds, &nanos);    }       if ((key->prog != mutex_key) ||    (!(OB2KEY(key)->initialized)) ||    (!(mut = OB2KEY(key)->mut))) { -  Pike_error("Bad argument 1 to condition->wait()\n"); +  Pike_error("Bad argument 1 to wait()\n");    }       if(args > 1) {    pop_n_elems(args - 1);    args = 1;    }       c = THIS_COND;       /* Unlock mutex */
pike.git/src/threads.c:2833:    */   static void f_thread_id_kill(INT32 args)   {    pop_n_elems(args);    low_thread_kill (THIS_THREAD);    push_int(0);   }      void init_thread_obj(struct object *UNUSED(o))   { -  MEMSET(&THIS_THREAD->state, 0, sizeof(struct Pike_interpreter_struct)); +  memset(&THIS_THREAD->state, 0, sizeof(struct Pike_interpreter_struct));    THIS_THREAD->thread_obj = Pike_fp->current_object;    THIS_THREAD->swapped = 0;    THIS_THREAD->status=THREAD_NOT_STARTED;    THIS_THREAD->flags = 0;    THIS_THREAD->waiting = 0;    SET_SVAL(THIS_THREAD->result, T_INT, NUMBER_UNDEFINED, integer, 0);    co_init(& THIS_THREAD->status_change);    THIS_THREAD->thread_local=NULL;   #ifdef CPU_TIME_MIGHT_BE_THREAD_LOCAL    THIS_THREAD->auto_gc_time = 0;