pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:2657:    push_int(THIS_THREAD->status);   }      /*! @decl protected string _sprintf(int c)    *!    *! Returns a string identifying the thread.    */   void f_thread_id__sprintf (INT32 args)   {    int c = 0; -  if(args>0 && Pike_sp[-args].type == PIKE_T_INT) +  if(args>0 && TYPEOF(Pike_sp[-args]) == PIKE_T_INT)    c = Pike_sp[-args].u.integer;    pop_n_elems (args);    if(c != 'O') {    push_undefined();    return;    }    push_constant_text ("Thread.Thread(");    push_int64(PTR_TO_INT(THREAD_T_TO_PTR(THIS_THREAD->id)));    push_constant_text (")");    f_add (3);
pike.git/src/threads.c:2811:   }      void init_thread_obj(struct object *o)   {    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; -  THIS_THREAD->result.type = T_INT; -  THIS_THREAD->result.subtype = NUMBER_UNDEFINED; -  THIS_THREAD->result.u.integer = 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;   #endif   }      static void cleanup_thread_state (struct thread_state *th)   {   #ifdef PIKE_DEBUG
pike.git/src/threads.c:2925:    *! This returns the value prevoiusly stored in the @[Local] object by    *! the @[set()] method by this thread.    *!    *! @seealso    *! @[set()]    */   void f_thread_local_get(INT32 args)   {    struct svalue key;    struct mapping *m; -  key.u.integer = ((struct thread_local *)CURRENT_STORAGE)->id; -  key.type = T_INT; -  key.subtype = NUMBER_NUMBER; +  SET_SVAL(key, T_INT, NUMBER_NUMBER, integer, +  ((struct thread_local *)CURRENT_STORAGE)->id);    pop_n_elems(args);    if(Pike_interpreter.thread_state != NULL &&    (m = Pike_interpreter.thread_state->thread_local) != NULL)    mapping_index_no_free(Pike_sp++, m, &key);    else {    push_undefined();    }   }      /*! @decl mixed set(mixed value)
pike.git/src/threads.c:2960:    *! @note    *! Note that the value set can only be retreived by the same thread.    *!    *! @seealso    *! @[get()]    */   void f_thread_local_set(INT32 args)   {    struct svalue key;    struct mapping *m; -  key.u.integer = ((struct thread_local *)CURRENT_STORAGE)->id; -  key.type = T_INT; -  key.subtype = NUMBER_NUMBER; +  SET_SVAL(key, T_INT, NUMBER_NUMBER, integer, +  ((struct thread_local *)CURRENT_STORAGE)->id);    if(args>1)    pop_n_elems(args-1);    else if(args<1)    SIMPLE_TOO_FEW_ARGS_ERROR("Thread.Local.set", 1);       if(Pike_interpreter.thread_state == NULL)    Pike_error("Trying to set Thread.Local without thread!\n");       if((m = Pike_interpreter.thread_state->thread_local) == NULL)    m = Pike_interpreter.thread_state->thread_local =
pike.git/src/threads.c:2986:   }      #ifdef PIKE_DEBUG   void gc_check_thread_local (struct object *o)   {    /* Only used by with locate_references. */    if (Pike_in_gc == GC_PASS_LOCATE) {    struct svalue key, *val;    struct thread_state *s;    -  key.u.integer = ((struct thread_local *)CURRENT_STORAGE)->id; -  key.type = T_INT; -  key.subtype = NUMBER_NUMBER; +  SET_SVAL(key, T_INT, NUMBER_NUMBER, integer, +  ((struct thread_local *)CURRENT_STORAGE)->id);       FOR_EACH_THREAD (s, {    if (s->thread_local &&    (val = low_mapping_lookup(s->thread_local, &key)))    debug_gc_check_svalues (val, 1,    " as thread local value in Thread.Local object"    " (indirect ref)");    });    }   }