pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:1570:    co_wait_interpreter(& m->condition);    SWAP_IN_CURRENT_THREAD();    check_threads_etc();    }while(m->key);    m->num_waiting--;    }      #ifdef PICKY_MUTEX    if (!Pike_fp->current_object->prog) {    free_object (o); -  if (!m->num_waiting) +  if (!m->num_waiting) {    co_destroy (&m->condition); -  +  }    Pike_error ("Mutex was destructed while waiting for lock.\n");    }   #endif       m->key=o;    OB2KEY(o)->mut=m;    add_ref (OB2KEY(o)->mutex_obj = Pike_fp->current_object);       DEBUG_CHECK_THREAD();   
pike.git/src/threads.c:1735:    if(m->num_waiting)    {    THREADS_FPRINTF(1, (stderr, "Destructed mutex is being waited on.\n"));    /* exit_mutex_key_obj has already signalled, but since the    * waiting threads will throw an error instead of making a new    * lock we need to double it to a broadcast. The last thread    * that stops waiting will destroy m->condition. */    co_broadcast (&m->condition);    }    } -  else +  else {    co_destroy(& m->condition); -  +  }   #endif   }      void exit_mutex_obj_compat_7_4(struct object *o)   {    struct mutex_storage *m = THIS_MUTEX;    struct object *key = m->key;       THREADS_FPRINTF(1, (stderr, "DESTROYING MUTEX m:%p\n", THIS_MUTEX));   
pike.git/src/threads.c:1821:    if (THIS_KEY->owner_obj) {    free_object(THIS_KEY->owner_obj);    THIS_KEY->owner_obj=0;    }    THIS_KEY->mut=0;    THIS_KEY->initialized=0;    mutex_obj = THIS_KEY->mutex_obj;    THIS_KEY->mutex_obj = NULL;    if (mut->num_waiting)    co_signal(&mut->condition); -  else if (mutex_obj && !mutex_obj->prog) +  else if (mutex_obj && !mutex_obj->prog) {    co_destroy (&mut->condition); -  +  }    if (mutex_obj)    free_object(mutex_obj);    }   }      /*! @endclass    */      /*! @class Condition    *!
pike.git/src/threads.c:1955:    SWAP_OUT_CURRENT_THREAD();    c->wait_count++;    if (seconds || nanos) {    co_wait_interpreter_timeout(&(c->cond), seconds, nanos);    } else {    co_wait_interpreter(&(c->cond));    }    c->wait_count--;    SWAP_IN_CURRENT_THREAD();    +  if (!mutex_obj->prog) { +  Pike_error("Mutex was destructed while waiting for cond.\n"); +  } +     /* Lock mutex */    mut->num_waiting++;    while(mut->key) {    SWAP_OUT_CURRENT_THREAD();    co_wait_interpreter(& mut->condition);    SWAP_IN_CURRENT_THREAD();    check_threads_etc();    }    mut->key=key;    OB2KEY(key)->mut=mut;    OB2KEY(key)->mutex_obj = mutex_obj;    mut->num_waiting--;    - #ifdef PICKY_MUTEX -  if (!mutex_obj->prog) { -  if (!mut->num_waiting) -  co_destroy (&mut->condition); -  Pike_error ("Mutex was destructed while waiting for lock.\n"); -  } - #endif -  +     pop_stack();    return;   }      /*! @decl void signal()    *!    *! @[signal()] wakes up one of the threads currently waiting for the    *! condition.    *!    *! @note