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.226 2003/11/13 03:28:26 mast Exp $ + || $Id: threads.c,v 1.227 2003/11/22 15:00:54 grubba Exp $   */      #ifndef CONFIGURE_TEST   #include "global.h" - RCSID("$Id: threads.c,v 1.226 2003/11/13 03:28:26 mast Exp $"); + RCSID("$Id: threads.c,v 1.227 2003/11/22 15:00:54 grubba 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:1288:   {    THREADS_FPRINTF(1, (stderr, "DESTROYING MUTEX m:%p\n", THIS_MUTEX));    if(THIS_MUTEX->key) destruct(THIS_MUTEX->key);    THIS_MUTEX->key=0;    co_destroy(& THIS_MUTEX->condition);   }      /*! @endclass    */    + /*! @class MutexKey +  *! +  *! Objects of this class are returned by @[Mutex()->lock()] +  *! and @[Mutex()->trylock()]. They are also passed as arguments +  *! to @[Condition()->wait()]. +  *! +  *! As long as they are held, the corresponding mutex will be locked. +  *! +  *! The corresponding mutex will be unlocked when the object +  *! is destructed (eg by not having any references left). +  *! +  *! @seealso +  *! @[Mutex], @[Condition] +  */   #define THIS_KEY ((struct key_storage *)(CURRENT_STORAGE))   void init_mutex_key_obj(struct object *o)   {    THREADS_FPRINTF(1, (stderr, "KEY k:%p, o:%p\n",    THIS_KEY, Pike_interpreter.thread_state));    THIS_KEY->mut=0;    THIS_KEY->mutex_obj = NULL;    THIS_KEY->owner = Pike_interpreter.thread_state;    add_ref(THIS_KEY->owner_obj = Pike_interpreter.thread_state->thread_obj);    THIS_KEY->initialized=1;
pike.git/src/threads.c:1329:    THIS_KEY->owner_obj=0;    }    free_object (THIS_KEY->mutex_obj);    THIS_KEY->mut=0;    THIS_KEY->mutex_obj = NULL;    THIS_KEY->initialized=0;    co_signal(& mut->condition);    }   }    + /*! @endclass +  */ +    #define THIS_COND ((COND_T *)(CURRENT_STORAGE))      /*! @class Condition    *!    *! Implementation of condition variables.    *!    *! Condition variables are used by threaded programs    *! to wait for events happening in other threads.    *!    *! @note