pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:1:   #include "global.h" - RCSID("$Id: threads.c,v 1.166 2001/09/24 16:45:39 grubba Exp $"); + RCSID("$Id: threads.c,v 1.167 2001/09/25 14:03:57 grubba Exp $");      PMOD_EXPORT int num_threads = 1;   PMOD_EXPORT int threads_disabled = 0;      #ifdef _REENTRANT   #include "threads.h"   #include "array.h"   #include "mapping.h"   #include "object.h"   #include "pike_macros.h"
pike.git/src/threads.c:1275:   /*! @decl int status()    */   void f_thread_id_status(INT32 args)   {    pop_n_elems(args);    push_int(THIS_THREAD->status);   }      /*! @decl static string _sprintf(int c)    *! -  *! Returns a string identifing the thread. +  *! Returns a string identifying the thread.    */   void f_thread_id__sprintf (INT32 args)   {    pop_n_elems (args);    push_constant_text ("Thread.Thread(");    push_int64((ptrdiff_t)THIS_THREAD->id);    push_constant_text (")");    f_add (3);   }    -  + /*! @decl static int id_number() +  *! +  *! Returns an id number identifying the thread. +  */ + void f_thread_id_id_number(INT32 args) + { +  pop_n_elems(args); +  push_int64((ptrdiff_t)THIS_THREAD->id); + } +    /*! @decl mixed result()    *!    *! Waits for the thread to complete, and then returns    *! the value returned from the thread function.    */   static void f_thread_id_result(INT32 args)   {    struct thread_state *th=THIS_THREAD;       SWAP_OUT_CURRENT_THREAD();
pike.git/src/threads.c:1761:    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("_sprintf",f_thread_id__sprintf,tFunc(tNone,tStr),0); +  ADD_FUNCTION("id_number",f_thread_id_id_number,tFunc(tNone,tInt),0);    set_gc_recurse_callback(thread_was_recursed);    set_gc_check_callback(thread_was_checked);    set_init_callback(init_thread_obj);    set_exit_callback(exit_thread_obj);    thread_id_prog=Pike_compiler->new_program;    thread_id_prog->flags |= PROGRAM_NO_EXPLICIT_DESTRUCT;    add_ref(thread_id_prog);    end_class("thread_id", 0);       /* function(mixed ...:object(Pike_interpreter.thread_id)) */