pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:1:   #include "global.h" - RCSID("$Id: threads.c,v 1.150 2001/01/24 08:17:28 hubbe Exp $"); + RCSID("$Id: threads.c,v 1.151 2001/02/06 17:10:38 per 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:1117: Inside #if defined(PIKE_DEBUG)
   debug_malloc_touch(f);    if(f->context.parent)    gc_external_mark2(f->context.parent,0," in Pike_fp->context.parent of idle thread");    gc_external_mark2(f->current_object,0," in Pike_fp->current_object of idle thread");    gc_external_mark2(f->context.prog,0," in Pike_fp->context.prog of idle thread");    }    }   #endif   }    - PMOD_EXPORT void f_thread_local(INT32 args) + void f_thread_local_create( INT32 args )   {    static INT32 thread_local_id = 0; -  +  ((struct thread_local *)Pike_fp->current_object->storage)->id = +  thread_local_id++; +  pop_n_elems(args); +  push_int(0); + }    -  + PMOD_EXPORT void f_thread_local(INT32 args) + {    struct object *loc = clone_object(thread_local_prog,0); -  ((struct thread_local *)loc->storage)->id = thread_local_id++; +     pop_n_elems(args);    push_object(loc);   }      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;
pike.git/src/threads.c:1399:    end_class("threads_disabled", 0);    tmp->flags|=PROGRAM_DESTRUCT_IMMEDIATE;    add_global_program("_disable_threads", tmp);    free_program(tmp);    }       START_NEW_PROGRAM_ID(THREAD_LOCAL);    ADD_STORAGE(struct thread_local);    ADD_FUNCTION("get",f_thread_local_get,tFunc(tNone,tMix),0);    ADD_FUNCTION("set",f_thread_local_set,tFunc(tSetvar(1,tMix),tVar(1)),0); +  ADD_EFUN("crate",f_thread_local_create, +  tFunc(tNone,tObjIs_THREAD_LOCAL), +  OPT_SIDE_EFFECT);    thread_local_prog=Pike_compiler->new_program;    add_ref(thread_local_prog);    end_class("thread_local", 0); -  if(!thread_local_prog) -  fatal("Failed to initialize thread_local program!\n"); +     ADD_EFUN("thread_local",f_thread_local,    tFunc(tNone,tObjIs_THREAD_LOCAL),    OPT_SIDE_EFFECT); -  +  if(!thread_local_prog) +  fatal("Failed to initialize thread_local program!\n");       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);