pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:1:   #include "global.h" - RCSID("$Id: threads.c,v 1.100 1999/06/19 20:18:43 hubbe Exp $"); + RCSID("$Id: threads.c,v 1.101 1999/07/01 01:39:13 hubbe Exp $");      int num_threads = 1;   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:739:    /* Needs to be cloned here, since create()    * might use threads.    */    o=clone_object(mutex_key,0);       DO_IF_DEBUG( if(thread_for_id(th_self()) != thread_id)    fatal("thread_for_id() (or thread_id) failed! %p != %p\n",thread_for_id(th_self()),thread_id) ; )       if(m->key)    { +  if(threads_disabled) +  { +  free_object(o); +  error("Cannot wait for mutexes when threads are disabled!\n"); +  }    SWAP_OUT_CURRENT_THREAD();    do    {    THREADS_FPRINTF(1, (stderr,"WAITING TO LOCK m:%08x\n",(unsigned int)m));    co_wait(& m->condition, & interpreter_lock);    }while(m->key);    SWAP_IN_CURRENT_THREAD();    }    m->key=o;    OB2KEY(o)->mut=m;
pike.git/src/threads.c:893:    error("Bad argument 1 to condition->wait()\n");       key=sp[-1].u.object;       if(key->prog != mutex_key)    error("Bad argument 1 to condition->wait()\n");       mut=OB2KEY(key)->mut;    if(!mut) error("Bad argument 1 to condition->wait()\n");    +  if(threads_disabled) +  error("Cannot wait for conditions when threads are disabled!\n"); +     /* Unlock mutex */    mut->key=0;    OB2KEY(key)->mut=0;    co_signal(& mut->condition);       /* Wait and allow mutex operations */    SWAP_OUT_CURRENT_THREAD();    co_wait(c, &interpreter_lock);       if(OB2KEY(key)->initialized)