Branch: Tag:


2014-11-25 12:41:39 by Stephen R. van den Berg <>

pgsql: Using howmuch with a sizeof compare of the Buffer does not work.

howmuch is the amount we need extra. It does not relate to the amount
already in the Buffer. To prevent a race/deadlock we need extra

165:    final Thread.Mutex fillreadmux;    final function(:void) gottimeout;    final int timeout; +  private int didreadcb;       protected bool range_error(int howmuch) {   #ifdef PG_DEBUG
174:    if(fillread) {    array cid=callout(gottimeout,timeout);    Thread.MutexKey lock=fillreadmux->lock(); -  if(howmuch>sizeof(this)) +  if(!didreadcb)    fillread.wait(lock); -  +  didreadcb=0;    lock=0;    local_backend->remove_call_out(cid);    } else
186:    final int read_cb(mixed id,mixed b) {    Thread.MutexKey lock=fillreadmux->lock();    if(fillread) -  fillread.signal(); +  didreadcb=1, fillread.signal();    lock=0;    return 0;    }