pike.git / lib / modules / Thread.pmod

version» Context lines:

pike.git/lib/modules/Thread.pmod:447: Inside #if constant(thread_create)
   }          static string _sprintf( int f )    {    switch( f )    {    case 't':    return "Thread.Farm().Result";    case 'O': -  return sprintf( "%t(%d %O)", this_object(), ready, value ); +  return sprintf( "%t(%d %O)", this, ready, value );    }    }    }       static class Handler    {    Mutex job_mutex = Mutex();    Condition cond = Condition();    array(object|array(function|array)) job;    object thread;
pike.git/lib/modules/Thread.pmod:481: Inside #if constant(thread_create)
   cond->wait(key);    if( q = job )    {    mixed res, err;    int st = gethrtime();    if( err = catch(res = q[1][0]( @q[1][1] )) && q[0])    ([object]q[0])->provide_error( err );    else if( q[0] )    ([object]q[0])->provide( res );    object lock = mutex->lock(); -  free_threads += ({ this_object() }); +  free_threads += ({ this });    lock = 0;    st = gethrtime()-st;    total_time += st/1000.0;    handled++;    job = 0;    if( st > max_time )    max_time = st;    ft_cond->broadcast();    } else {    object lock = mutex->lock(); -  threads -= ({ this_object() }); -  free_threads -= ({ this_object() }); +  threads -= ({ this }); +  free_threads -= ({ this });    lock = 0;    destruct();    return;    }    }    }       void run( array(function|array) what, object|void resobj )    {    while(!ready) sleep(0.1);
pike.git/lib/modules/Thread.pmod:539: Inside #if constant(thread_create)
   }          static string _sprintf( int f )    {    switch( f )    {    case 't':    return "Thread.Farm().Handler";    case 'O': -  return sprintf( "%t(%f / %d, %d)", this_object(), +  return sprintf( "%t(%f / %d, %d)", this,    total_time, max_time, handled );    }    }    }       static array(Handler) threads = ({});    static array(Handler) free_threads = ({});    static int max_num_threads = 20;       static Handler aquire_thread()
pike.git/lib/modules/Thread.pmod:688:   }      /* Fallback implementation of Thread.MutexKey */   optional class MutexKey (static function(:void) dec_locks)   {    int `!()    {    // Should be destructed when the mutex is, but we can't pull that    // off. Try to simulate it as well as possible.    if (dec_locks) return 0; -  destruct (this_object()); +  destruct (this);    return 1;    }       static void destroy()    {    if (dec_locks) dec_locks();    }   }      /* Fallback implementation of Thread.Mutex */