pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:1:   #include "global.h" - RCSID("$Id: threads.c,v 1.44 1997/10/05 03:40:34 grubba Exp $"); + RCSID("$Id: threads.c,v 1.45 1997/10/16 06:34:28 hubbe 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:392:    push_int(0);    f_allocate(1);    }   }      void init_thread_obj(struct object *o)   {    MEMSET(o->storage, 0, sizeof(struct thread_state));   }    + #ifdef DEBUG + static void thread_was_marked(struct object *o) + { +  struct thread_state *tmp=(struct thread_state *)(o->storage); +  if(tmp->swapped) +  { +  gc_xmark_svalues(tmp->evaluator_stack,tmp->sp-tmp->evaluator_stack-1); +  } + } + #endif +    void th_init(void)   {    struct program *tmp;    INT32 mutex_key_offset;      #ifdef SGI_SPROC_THREADS   #error /* Need to specify a filename */    us_cookie = usinit("");   #endif /* SGI_SPROC_THREADS */   
pike.git/src/threads.c:463:    add_function("wait",f_cond_wait,"function(void|object:void)",0);    add_function("signal",f_cond_signal,"function(:void)",0);    add_function("broadcast",f_cond_broadcast,"function(:void)",0);    set_init_callback(init_cond_obj);    set_exit_callback(exit_cond_obj);    end_class("condition", 0);       start_new_program();    add_storage(sizeof(struct thread_state));    add_function("backtrace",f_thread_backtrace,"function(:array)",0); + #ifdef DEBUG +  set_gc_mark_callback(thread_was_marked); + #endif    set_init_callback(init_thread_obj);    thread_id_prog=end_program();    if(!mutex_key)    fatal("Failed to initialize thread program!\n");       thread_id=clone_object(thread_id_prog,0);    SWAP_OUT_THREAD((struct thread_state *)thread_id->storage); /* Init struct */    ((struct thread_state *)thread_id->storage)->swapped=0;   }