pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:2048:    * since it at this point only has one reference.    *    * We also want the stuff in arg to be copied properly    * before we exit the function...    */    SWAP_OUT_CURRENT_THREAD();    THREADS_FPRINTF(0, (stderr, "f_thread_create %p waiting...\n",    thread_state));    while (thread_state->status == THREAD_NOT_STARTED)    low_co_wait_interpreter (&thread_state->status_change); -  if (threads_disabled) { -  /* Some other thread disabled threads while we were waiting for -  * the cond var. Wait for the threads disabled lock to be released. -  */ -  threads_disabled_wait(DLOC); -  } +     THREADS_FPRINTF(0, (stderr, "f_thread_create %p continue\n", thread_state));    SWAP_IN_CURRENT_THREAD();    } else {    low_cleanup_interpret(&thread_state->state);    free_array(arg.args);    Pike_error("Failed to create thread (errno = %d).\n", tmp);    }       THREADS_FPRINTF(0, (stderr, "f_thread_create %p done\n", thread_state));    push_int(0);
pike.git/src/threads.c:2325:    Pike_error("Cannot wait for mutexes when threads are disabled!\n");    }    do    {    THREADS_FPRINTF(1, (stderr,"WAITING TO LOCK m:%p\n",m));    SWAP_OUT_CURRENT_THREAD();    co_wait_interpreter(& m->condition);    SWAP_IN_CURRENT_THREAD();    check_threads_etc();    }while(m->key); -  if (threads_disabled) { -  /* Some other thread disabled threads while we were waiting for -  * the mutex. Wait for the threads disabled lock to be released. -  */ -  SWAP_OUT_CURRENT_THREAD(); -  threads_disabled_wait(DLOC); -  SWAP_IN_CURRENT_THREAD(); -  check_threads_etc(); -  } +     m->num_waiting--;    }      #ifdef PICKY_MUTEX    if (!Pike_fp->current_object->prog) {    free_object (o);    if (!m->num_waiting) {    co_destroy (&m->condition);    }    Pike_error ("Mutex was destructed while waiting for lock.\n");
pike.git/src/threads.c:2794:    }       /* Lock mutex */    mut->num_waiting++;    while(mut->key) {    SWAP_OUT_CURRENT_THREAD();    co_wait_interpreter(& mut->condition);    SWAP_IN_CURRENT_THREAD();    check_threads_etc();    } -  if (threads_disabled) { -  /* Some other thread disabled threads while we were waiting for the mutex -  * or the cond var. Wait for the threads disabled lock to be released. -  */ -  SWAP_OUT_CURRENT_THREAD(); -  threads_disabled_wait(DLOC); -  SWAP_IN_CURRENT_THREAD(); -  check_threads_etc(); -  } +     mut->key=key;    OB2KEY(key)->mut=mut;    OB2KEY(key)->mutex_obj = mutex_obj;    mut->num_waiting--;       pop_stack();    return;   }      /*! @decl void signal()
pike.git/src/threads.c:2988:    Pike_error("Cannot wait for threads when threads are disabled!\n");    }       th->waiting++;       THREADS_FPRINTF(0, (stderr, "Thread->wait(): Waiting for thread_state %p "    "(state:%d).\n", th, th->status));    while(th->status < THREAD_EXITED) {    SWAP_OUT_CURRENT_THREAD();    co_wait_interpreter(&th->status_change); -  if (threads_disabled) { -  /* Some other thread disabled threads while we were waiting for -  * the cond var. Wait for the threads disabled lock to be released. -  */ -  threads_disabled_wait(DLOC); -  } +     SWAP_IN_CURRENT_THREAD();    check_threads_etc();    THREADS_FPRINTF(0,    (stderr, "Thread->wait(): Waiting for thread_state %p "    "(state:%d).\n", th, th->status));    }       th_status = th->status;       assign_svalue_no_free(Pike_sp, &th->result);