pike.git
/
lib
/
modules
/
Sql.pmod
/
pgsql_util.pmod
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:425:
#endif private inline void queueup(Result portal) { qportals->write(portal); portal->_synctransact = synctransact; PD("%d>%O %d %d Queue portal %d bytes\n", socket->query_fd(), portal._portalname, ++queueoutidx, synctransact, sizeof(this)); } final bufcon|conxsess start(void|int waitforreal) { Thread.MutexKey lock;
+
#ifdef PG_DEBUGRACE
+
if (nostash->current_locking_thread())
+
PD("Nostash locked by %s\n",
+
describe_backtrace(nostash->current_locking_thread()->backtrace()));
+
#endif
if (lock = (waitforreal ? nostash->lock : nostash->trylock)(1)) { int mode; #ifdef PG_DEBUGRACE conxsess sess = conxsess(this); #endif started = lock; lock = shortmux->lock(); stashcount->wait_till_drained(lock); mode = getstash(KEEP); lock = 0;
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:1479:
} _state = PURGED; } releaseconditions(); } final int _closeportal(conxsess cs) { void|bufcon|conxsess plugbuffer = CHAIN(cs); int retval = KEEP; PD("%O Try Closeportal %d\n", _portalname, _state);
-
Thread.MutexKey lock = closemux->lock();
+
Thread.MutexKey lock = closemux->lock(
2
);
// When called from _sendexecute(), it is already locked
_fetchlimit = 0; // disables further Executes switch (_state) { case PARSING: case BOUND: _releasestatement(1); } switch (_state) { case PORTALINIT: case PARSING: _unnamedstatementkey = 0;
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:1523:
*/ pgsqlsess->readyforquerycount++, retval = SYNCSEND; pgsqlsess->pportalcount = 0; } } return retval; } private void replenishrows() { if (_fetchlimit && sizeof(datarows) <= _fetchlimit >> 1) {
+
Thread.MutexKey lock = closemux->lock();
+
if (_fetchlimit) {
_fetchlimit = pgsqlsess._fetchlimit; if (bytesreceived) _fetchlimit = min((portalbuffersize >> 1) * index / bytesreceived || 1, _fetchlimit);
-
Thread.MutexKey
lock
=
closemux->lock
()
;
-
if
(_fetchlimit
&&
inflight <= (_fetchlimit - 1) >> 1)
+
if
(
_fetchlimit
)
+
if (inflight <= (_fetchlimit - 1) >> 1)
_sendexecute(_fetchlimit);
-
else
if
(!_fetchlimit)
+
else
PD("<%O _fetchlimit %d, inflight %d, skip execute\n", _portalname, _fetchlimit, inflight); } }
-
+
}
final void _processdataready(array datarow, void|int msglen) { bytesreceived += msglen; inflight--; if (_state<CLOSED) datarows->write(datarow); if (++index == 1) PD("<%O _fetchlimit %d=min(%d||1,%d), inflight %d\n", _portalname, _fetchlimit, (portalbuffersize >> 1) * index / bytesreceived, pgsqlsess._fetchlimit, inflight);