pike.git / lib / modules / Thread.pmod

version» Context lines:

pike.git/lib/modules/Thread.pmod:673: Inside #if constant(thread_create)
   {    thread_create( dispatcher );    }   }      #else /* !constant(thread_create) */      // Simulations of some of the classes for nonthreaded use.      /* Fallback implementation of Thread.Local */ - class Local + optional class Local   {    static mixed data;    mixed get() {return data;}    mixed set (mixed val) {return data = val;}   }      /* Fallback implementation of Thread.MutexKey */ - class MutexKey (static function(:void) dec_locks) + 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());    return 1;    }       static void destroy()    {    if (dec_locks) dec_locks();    }   }      /* Fallback implementation of Thread.Mutex */ - class Mutex + optional class Mutex   {    static int locks = 0;    static void dec_locks() {locks--;}       MutexKey lock (int|void type)    {    switch (type) {    default:    error ("Unknown mutex locking style: %d\n", type);    case 0:
pike.git/lib/modules/Thread.pmod:743:    case 1:    case 2:    }    if (locks) return 0;    locks++;    return MutexKey (dec_locks);    }   }      // Fallback implementation of Thread.Fifo. - class Fifo + optional class Fifo   {    array buffer;    int ptr, num;    int read_tres, write_tres;       int size() { return num; }       mixed read()    {    if (!num) error ("Deadlock detected - fifo empty.\n");
pike.git/lib/modules/Thread.pmod:828:    }       static string _sprintf( int f )    {    return f=='O' && sprintf( "%O(%d / %d)", this_program,    size(), read_tres );    }   }      // Fallback implementation of Thread.Queue. - class Queue + optional class Queue   {    array buffer=allocate(16);    int r_ptr, w_ptr;       int size() { return w_ptr - r_ptr; }       mixed read()    {    if (w_ptr == r_ptr) error ("Deadlock detected - queue empty.\n");    return try_read();