pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:1:   #include "global.h" - RCSID("$Id: threads.c,v 1.151 2001/02/01 19:58:56 grubba Exp $"); + RCSID("$Id: threads.c,v 1.152 2001/02/06 16:10:47 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:844:    *! This function attempts to lock the mutex. If the mutex is already    *! locked by a different thread the current thread will sleep until the    *! mutex is unlocked. The value returned is the 'key' to the lock. When    *! the key is destructed or has no more references the lock will    *! automatically be unlocked. The key will also be destructed if the lock    *! is destructed.    *!    *! The @[type] argument specifies what @[lock()] should do if the    *! mutex is already locked by this thread:    *! @int -  *! @value 0 (default) +  *! @value 0    *! Throw an error.    *! @value 1    *! Sleep until the mutex is unlocked. Useful if some    *! other thread will unlock it.    *! @value 2    *! Return zero. This allows recursion within a locked region of    *! code, but in conjunction with other locks it easily leads    *! to unspecified locking order and therefore a risk for deadlocks.    *! @endint    *!
pike.git/src/threads.c:1153:    SWAP_IN_CURRENT_THREAD();       pop_n_elems(args);   }      /*! @decl void signal()    *!    *! @[signal()] wakes up one of the threads currently waiting for the    *! condition.    *! -  *! @bugs +  *! @note    *! Sometimes more than one thread is woken up.    *!    *! @seealso    *! @[broadcast()]    */   void f_cond_signal(INT32 args) { pop_n_elems(args); co_signal(THIS_COND); }      /*! @decl void broadcast()    *!    *! @[broadcast()] wakes up all threads currently waiting for this condition.
pike.git/src/threads.c:1275:   void exit_thread_obj(struct object *o)   {    if(THIS_THREAD->thread_local != NULL) {    free_mapping(THIS_THREAD->thread_local);    THIS_THREAD->thread_local = NULL;    }    co_destroy(& THIS_THREAD->status_change);    th_destroy(& THIS_THREAD->id);   }    - /*! @end class + /*! @endclass    */      static void thread_was_recursed(struct object *o)   {    struct thread_state *tmp=THIS_THREAD;    if(tmp->thread_local != NULL)    gc_recurse_mapping(tmp->thread_local);   }      static void thread_was_checked(struct object *o)
pike.git/src/threads.c:1408:    if((m = OBJ2THREAD(Pike_interpreter.thread_id)->thread_local) == NULL)    m = OBJ2THREAD(Pike_interpreter.thread_id)->thread_local =    allocate_mapping(4);       mapping_insert(m, &key, &Pike_sp[-1]);   }      /*! @endclass    */    + /*! @endmodule +  */ +    /* Thread farm code by Per    *    */   static struct farmer {    struct farmer *neighbour;    void *field;    void (*harvest)(void *);    THREAD_T me;    COND_T harvest_moon;   #ifdef HAVE_BROKEN_LINUX_THREAD_EUID