pike.git / lib / modules / Thread.pmod

version» Context lines:

pike.git/lib/modules/Thread.pmod:125: Inside #if constant(thread_create)
   array ret;    object key=lock::lock(2);    while(!num) r_cond::wait(key);    if(num==1)    {    ret=buffer[ptr..ptr];    buffer[ptr++] = 0; // Throw away any references.    ptr%=sizeof(buffer);    num--;    }else{ -  ret=buffer[ptr..]+buffer[..num-sizeof(ret)-1]; +  if (ptr+num < sizeof(buffer)) { +  ret = buffer[ptr..ptr+num-1]; +  } else { +  ret = buffer[ptr..]+buffer[..num-(sizeof(buffer)-ptr)-1]; +  }    ptr=num=0;    buffer=allocate(sizeof(buffer)); // Throw away any references.    }    key = 0;    w_cond::broadcast();    return ret;    }       //! Append a @[value] to the end of the fifo. If there is no more    //! room in the fifo the current thread will sleep until space is