pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: threads.c,v 1.225 2003/11/09 01:09:22 mast Exp $ + || $Id: threads.c,v 1.226 2003/11/13 03:28:26 mast Exp $   */      #ifndef CONFIGURE_TEST   #include "global.h" - RCSID("$Id: threads.c,v 1.225 2003/11/09 01:09:22 mast Exp $"); + RCSID("$Id: threads.c,v 1.226 2003/11/13 03:28:26 mast Exp $");      PMOD_EXPORT int num_threads = 1;   PMOD_EXPORT int threads_disabled = 0;   #endif /* !CONFIGURE_TEST */      #ifdef _REENTRANT      #ifndef CONFIGURE_TEST      #include "threads.h"
pike.git/src/threads.c:1833: Inside #if defined(HAVE_BROKEN_LINUX_THREAD_EUID)
   me->euid = geteuid();    me->egid = getegid();   #endif /* HAVE_BROKEN_LINUX_THREAD_EUID */       th_create_small(&me->me, farm, me);    return me;   }      PMOD_EXPORT void th_farm(void (*fun)(void *), void *here)   { + #ifdef PIKE_DEBUG    if(!fun) Pike_fatal("The farmers don't known how to handle empty fields\n"); -  + #endif    mt_lock( &rosie );    if(farmers)    {    struct farmer *f = farmers;    farmers = f->neighbour;    f->field = here;    f->harvest = fun;    mt_unlock( &rosie );    co_signal( &f->harvest_moon );    return;
pike.git/src/threads.c:1901:    mutex_key_offset + OFFSETOF(key_storage, owner_obj),    tObjIs_THREAD_ID, T_OBJECT, 0);    PIKE_MAP_VARIABLE("_mutex", mutex_key_offset + OFFSETOF(key_storage, mutex_obj),    tObjIs_THREAD_MUTEX, T_OBJECT, ID_STATIC|ID_PRIVATE);    set_init_callback(init_mutex_key_obj);    set_exit_callback(exit_mutex_key_obj);    mutex_key=Pike_compiler->new_program;    add_ref(mutex_key);    end_class("mutex_key", 0);    mutex_key->flags|=PROGRAM_DESTRUCT_IMMEDIATE; - #ifdef PIKE_DEBUG -  if(!mutex_key) -  Pike_fatal("Failed to initialize mutex_key program!\n"); - #endif +        START_NEW_PROGRAM_ID(THREAD_MUTEX);    ADD_STORAGE(struct mutex_storage);    ADD_FUNCTION("lock",f_mutex_lock,    tFunc(tOr(tInt02,tVoid),tObjIs_THREAD_MUTEX_KEY),0);    ADD_FUNCTION("trylock",f_mutex_trylock,    tFunc(tOr(tInt02,tVoid),tObjIs_THREAD_MUTEX_KEY),0);    ADD_FUNCTION("current_locking_thread",f_mutex_locking_thread,    tFunc(tNone,tObjIs_THREAD_ID), 0);    ADD_FUNCTION("current_locking_key",f_mutex_locking_key,
pike.git/src/threads.c:1955:    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_FUNCTION("create", f_thread_local_create,    tFunc(tVoid,tVoid), ID_STATIC);   #ifdef PIKE_DEBUG    set_gc_check_callback(gc_check_thread_local);   #endif    thread_local_prog=Pike_compiler->new_program;    add_ref(thread_local_prog);    end_class("thread_local", 0); -  if(!thread_local_prog) -  Pike_fatal("Failed to initialize thread_local program!\n"); +     ADD_EFUN("thread_local", f_thread_local,    tFunc(tNone,tObjIs_THREAD_LOCAL),    OPT_EXTERNAL_DEPEND);       START_NEW_PROGRAM_ID(THREAD_ID);    thread_storage_offset=ADD_STORAGE(struct thread_state);    PIKE_MAP_VARIABLE("result", OFFSETOF(thread_state, result),    tMix, T_MIXED, 0);    ADD_FUNCTION("create",f_thread_create,    tFuncV(tNone,tMixed,tVoid),
pike.git/src/threads.c:1998:       ADD_EFUN("all_threads",f_all_threads,    tFunc(tNone,tArr(tObjIs_THREAD_ID)),    OPT_EXTERNAL_DEPEND);       /* Some constants... */    add_integer_constant("THREAD_NOT_STARTED", THREAD_NOT_STARTED, 0);    add_integer_constant("THREAD_RUNNING", THREAD_RUNNING, 0);    add_integer_constant("THREAD_EXITED", THREAD_EXITED, 0);    -  if(!mutex_key) -  Pike_fatal("Failed to initialize thread program!\n"); -  +     backend_thread_obj = fast_clone_object(thread_id_prog);    INIT_THREAD_STATE((struct thread_state *)(backend_thread_obj->storage +    thread_storage_offset));    thread_table_insert(Pike_interpreter.thread_state);   }      void th_cleanup(void)   {    th_running = 0;