pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:1:   #include "global.h" - RCSID("$Id: threads.c,v 1.107 2000/01/16 05:57:34 hubbe Exp $"); + RCSID("$Id: threads.c,v 1.108 2000/02/06 19:15:50 mast Exp $");      int num_threads = 1;   int threads_disabled = 0;      #ifdef _REENTRANT   #include "threads.h"   #include "array.h"   #include "mapping.h"   #include "object.h"   #include "pike_macros.h"   #include "callback.h"   #include "builtin_functions.h"   #include "constants.h"   #include "program.h"   #include "program_id.h"   #include "gc.h"   #include "main.h"   #include "module_support.h"   #include "pike_types.h" -  + #include "operators.h"      #include <errno.h>      int live_threads = 0;   COND_T live_threads_change;   COND_T threads_disabled_change;   size_t thread_stack_size=1024 * 1204;      #ifndef HAVE_PTHREAD_ATFORK   #include "callback.h"
pike.git/src/threads.c:994:    f_allocate(1);    }   }      void f_thread_id_status(INT32 args)   {    pop_n_elems(args);    push_int(THIS_THREAD->status);   }    + void f_thread_id_id(INT32 args) + { +  pop_n_elems(args); +  push_int(THIS_THREAD->id); + } +  + void f_thread_id__sprintf (INT32 args) + { +  pop_n_elems (args); +  push_constant_text ("Thread.Thread("); +  push_int (THIS_THREAD->id); +  push_constant_text (")"); +  f_add (3); + } +    static void f_thread_id_result(INT32 args)   {    struct thread_state *th=THIS_THREAD;       SWAP_OUT_CURRENT_THREAD();       while(th->status != THREAD_EXITED)    co_wait(&th->status_change, &interpreter_lock);       SWAP_IN_CURRENT_THREAD();
pike.git/src/threads.c:1229:       START_NEW_PROGRAM_ID(THREAD_ID);    thread_storage_offset=ADD_STORAGE(struct thread_state);    thread_id_result_variable=simple_add_variable("result","mixed",0);    /* function(:array) */    ADD_FUNCTION("backtrace",f_thread_backtrace,tFunc(tNone,tArray),0);    /* function(:mixed) */    ADD_FUNCTION("wait",f_thread_id_result,tFunc(tNone,tMix),0);    /* function(:int) */    ADD_FUNCTION("status",f_thread_id_status,tFunc(tNone,tInt),0); +  ADD_FUNCTION("id",f_thread_id_id,tFunc(tNone,tInt),0); +  ADD_FUNCTION("_sprintf",f_thread_id__sprintf,tFunc(tNone,tStr),0);    set_gc_mark_callback(thread_was_marked);    set_gc_check_callback(thread_was_checked);    set_init_callback(init_thread_obj);    set_exit_callback(exit_thread_obj);    thread_id_prog=new_program;    add_ref(thread_id_prog);    end_class("thread_id", 0);       /* function(mixed ...:object(thread_id)) */    ADD_EFUN("thread_create",f_thread_create,