pike.git / lib / modules / Sql.pmod / pgsql_util.pmod

version» Context lines:

pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:304:    } while(0);    lock=started=0;    return;    };    lock=0;    if(pgsqlsess)    pgsqlsess->_connectfail();    }       final void sendterminate() { -  destruct(fillread); // Delayed close() after flushing the output buffer +  Thread.MutexKey lock=fillreadmux->lock(); +  fillread.signal(); +  fillread=0; // Delayed close() after flushing the output buffer +  lock=0;    }       final int close() {    destruct(nostash);    PD("%d>Close socket\n",socket->query_fd());    return socket->close();    }       protected void destroy() {    catch(close()); // Exceptions don't work inside destructors
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:791:    }    }    if(_tprepared)    if(_tprepared.datarowdesc)    gotdatarowdesc(plugbuffer);    else if(dontcacheprefix->match(_query)) // Don't cache FETCH/COPY    m_delete(pgsqlsess->_prepareds,_query),_tprepared=0;    if(prepbufferready) {    lock=prepbuffermux->lock();    prepbuffer=plugbuffer; -  catch(prepbufferready->signal()); +  if(prepbufferready) +  prepbufferready->signal();    }    }    lock=0;    }       final void _processrowdesc(array(mapping(string:mixed)) datarowdesc) {    _setrowdesc(datarowdesc);    if(_tprepared)    _tprepared.datarowdesc=datarowdesc;    if(prepbufferready)    Thread.Thread(gotdatarowdesc); // Do not use callout, it deadlocks    }       private void gotdatarowdesc(void|Stdio.Buffer plugbuffer) {    Thread.MutexKey lock=prepbuffermux->lock();    if(!plugbuffer) { -  if(!prepbuffer) -  catch(prepbufferready->wait(lock)); +  if(!prepbuffer && prepbufferready) +  prepbufferready->wait(lock);    plugbuffer=prepbuffer;    prepbuffer=0; // Free memory when plugbuffer leaves scope    }    if(!prepbufferready || _state>=CLOSING)    lock=_unnamedstatementkey=0;    else { -  destruct(prepbufferready); // Make sure we do this exactly once +  prepbufferready->signal(); +  prepbufferready=0; // Make sure we do this exactly once    lock=0;    plugbuffer->add_int16(sizeof(datarowdesc));    if(sizeof(datarowdesc))    foreach(datarowdesc;;mapping col)    plugbuffer->add_int16(oidformat(col.type));    else if(commitprefix->match(_query)) {    lock=pgsqlsess->_shortmux->lock();    if(pgsqlsess->_portalsinflight) {    pgsqlsess->_waittocommit++;    PD("Commit waiting for portals to finish\n");
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:941:    PD("<%O _fetchlimit %d, inflight %d, skip execute\n",    _portalname,_fetchlimit,inflight);    lock=0;    }    }       private void releaseconditions() {    pgsqlsess=0;    Thread.MutexKey lock;    if(prepbufferready) { -  Thread.MutexKey lock=prepbuffermux->lock(); -  catch(prepbufferready->signal()); +  lock=prepbuffermux->lock(); +  if(prepbufferready) +  prepbufferready->signal();    }    if(!datarowdesc) {    lock=_ddescribemux->lock();    datarowdesc=({});    _ddescribe->broadcast();    }    lock=0;    }       final void _releasesession(void|string statusccomplete) {