pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:1:   #include "global.h" - RCSID("$Id: threads.c,v 1.68 1998/04/13 14:31:59 grubba Exp $"); + RCSID("$Id: threads.c,v 1.69 1998/04/20 18:53:24 grubba Exp $");      int num_threads = 1;   int threads_disabled = 0;      #ifdef _REENTRANT   #include "threads.h"   #include "array.h"   #include "object.h"   #include "pike_macros.h"   #include "callback.h"
pike.git/src/threads.c:274:    struct thread_state *s;       pop_n_elems(args);    oldsp = sp;    mt_lock( & thread_table_lock );    for(x=0; x<THREAD_TABLE_SIZE; x++)    for(s=thread_table_chains[x]; s; s=s->hashlink) {    struct object *o =    (struct object *)(((char *)s)-((((struct object *)NULL)->storage)-    ((char*)NULL))); -  o->refs++; -  push_object(o); +  ref_push_object(o);    }    mt_unlock( & thread_table_lock );    f_aggregate(sp-oldsp);   }         static void check_threads(struct callback *cb, void *arg, void * arg2)   {    static int div_;    if(div_++ & 255) return;
pike.git/src/threads.c:396:    if(!tmp)    {    num_threads++;    thread_table_insert(arg->id);       if(!threads_evaluator_callback)    {    threads_evaluator_callback=add_to_callback(&evaluator_callbacks,    check_threads, 0,0);    } -  push_object(arg->id); -  arg->id->refs++; +  ref_push_object(arg->id);    THREADS_FPRINTF((stderr,"THREAD_CREATE -> t:%08x\n",(unsigned int)arg->id));    } else {    free_object(arg->id);    free_array(arg->args);    free((char *)arg);    error("Failed to create thread (errno = %d).\n",tmp);    }   }      #ifdef UNIX_THREADS
pike.git/src/threads.c:422: Inside #if defined(UNIX_THREADS)
   else error("No argument to thread_set_concurrency(int concurrency);\n");    pop_n_elems(args);    num_lwps=c;    th_setconcurrency(c);   }   #endif      void f_this_thread(INT32 args)   {    pop_n_elems(args); -  push_object(thread_id); -  thread_id->refs++; +  ref_push_object(thread_id);   }      #define THIS_MUTEX ((struct mutex_storage *)(fp->current_storage))         /* Note:    * No reference is kept to the key object, it is destructed if the    * mutex is destructed. The key pointer is set to zero by the    * key object when the key is destructed.    */
pike.git/src/threads.c:556:    THIS_MUTEX->key=0;    co_destroy(& THIS_MUTEX->condition);   }      #define THIS_KEY ((struct key_storage *)(fp->current_storage))   void init_mutex_key_obj(struct object *o)   {    THREADS_FPRINTF((stderr, "KEY k:%08x, o:%08x\n",    (unsigned int)THIS_KEY, (unsigned int)thread_id));    THIS_KEY->mut=0; -  THIS_KEY->owner=thread_id; -  thread_id->refs++; +  add_ref(THIS_KEY->owner=thread_id);    THIS_KEY->initialized=1;   }      void exit_mutex_key_obj(struct object *o)   {    THREADS_FPRINTF((stderr, "UNLOCK k:%08x m:(%08x) t:%08x o:%08x\n",    (unsigned int)THIS_KEY,    (unsigned int)THIS_KEY->mut,    (unsigned int)thread_id,    (unsigned int)THIS_KEY->owner));