pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:1867:    *!    *! @seealso    *! @[Mutex], @[Condition], @[this_thread()]    */   void f_thread_create(INT32 args)   {    struct thread_starter arg;    struct thread_state *thread_state =    (struct thread_state *)Pike_fp->current_storage;    int tmp; +  int orig_threads_disabled = threads_disabled;       if (args < 1) {    SIMPLE_WRONG_NUM_ARGS_ERROR("create", 1);    }    if (!callablep(Pike_sp - args)) {    SIMPLE_ARG_TYPE_ERROR("create", 1, "function");    }       if (thread_state->status != THREAD_NOT_STARTED) {    Pike_error("Threads can not be restarted (status:%d).\n",
pike.git/src/threads.c:1925:    * The main race is the one on current_object,    * 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, "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) { +  if (!orig_threads_disabled && 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, "f_thread_create %p continue\n", thread_state);    SWAP_IN_CURRENT_THREAD();    } else {    low_cleanup_interpret(&thread_state->state);    free_array(arg.args);