Branch: Tag:

2016-04-01

2016-04-01 01:29:32 by Stephen R. van den Berg <srb@cuci.nl>

pgsql: Ensure queries have been fully started before closing the fd.

63:      final int _fetchlimit=FETCHLIMIT;   final Thread.Mutex _unnamedportalmux; - private Thread.Mutex unnamedstatement,termthread; + private Thread.Mutex unnamedstatement;   private Thread.MutexKey termlock;   final int _portalsinflight;   
1201:   /*semi*/final void close() {    if(qportals && qportals->size())    catch(cancelquery()); -  termlock=(termthread=Thread.Mutex())->lock(); +  termlock=unnamedstatement->lock(1);    c->close(); -  termthread->lock(1); +  unnamedstatement->lock(1);    destruct(c);destruct(waitforauthready);   }   
1258: Inside #if defined(PG_STATS)
  #ifdef PG_STATS    prepstmtused=0;   #endif -  termlock=(termthread=Thread.Mutex())->lock(); +  termlock=unnamedstatement->lock(1);    c->close(); -  termthread->lock(1); +  unnamedstatement->lock(1);    destruct(c);    PD("Flushing old cache\n");    foreach(_prepareds;;mapping tp)