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

version» Context lines:

pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:364:    final bufcon start(void|int|array(Thread.MutexKey) waitforreal) {    dirty = stashcount->acquire();   #ifdef PG_DEBUG    if (waitforreal)    error("pgsql.bufcon not allowed here\n");   #endif    return this;    }       final void sendcmd(int mode, void|Result portal) { -  Thread.MutexKey lock = shortmux->lock(); +  void|Thread.MutexKey lock = shortmux->lock();    if (portal)    realbuffer->stashqueue->write(portal);    if (mode == SYNCSEND) {    add(PGSYNC);    realbuffer->stashqueue->write(1);    mode = SENDOUT; // Demote it to prevent an extra SYNC upon stashflush    }    realbuffer->stash->add(this);    PD("%d>Stashed mode %d > %d\n",    realbuffer->socket->query_fd(), mode, realbuffer->stashflushmode);
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:444:    throw(MAGICTERMINATE);    return true;    }       final int read_cb(mixed id, mixed b) {    PD("Read callback %O\n", b && ((string)b)   #ifndef PG_DEBUGMORE    [..255]   #endif    ); -  Thread.MutexKey lock = fillreadmux->lock(); +  void|Thread.MutexKey lock = fillreadmux->lock();    if (procmsg && id)    procmsg = 0, lock = 0, Thread.Thread(id);    else if (fillread)    didreadcb = 1, fillread.signal();    return 0;    }       protected void create() {    i::create();    fillreadmux = MUTEX();
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:470:    inherit Stdio.File;    final int query_fd() {    return is_open() ? ::query_fd() : -1;    }   };      class conxion {    inherit Stdio.Buffer:o;    final conxiin i;    -  private Thread.Queue qportals; +  private zero|Thread.Queue qportals;    final MUTEX shortmux;    private int closenext;       final sfile   #if constant(SSL.File)    |SSL.File   #endif    socket;    final Shuffler.Shuffle shuffle;    final multiset(Result) runningportals = (<>);
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:772:    "queued portals: %d output queue: %d/%d\n"    "started: %d\n",    fd, sizeof(i), i->_size_object(),    qportals && qportals->size(), sizeof(this), _size_object(),    !!started);    break;    }    return res;    }    -  protected void create(proxy pgsqlsess, Thread.Queue _qportals, int nossl) { +  protected void create(proxy pgsqlsess, zero|Thread.Queue _qportals, int nossl) {    o::create();    qportals = _qportals;    synctransact = 1;    socket = sfile();    i = conxiin();    shortmux = MUTEX();    nostash = MUTEX();    closenext = 0;    stashqueue = Thread.Queue();    stash = Stdio.Buffer();
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:948:       //! Returns the command-complete status for this query.    //!    //! @seealso    //! @[Sql.Result()->status_command_complete()]    /*semi*/final string status_command_complete() {    if (!statuscmdcomplete) {    if (!datarowtypes)    waitfordescribe();    { -  Thread.MutexKey lock = closemux->lock(); +  void|Thread.MutexKey lock = closemux->lock();    if (_fetchlimit) {    array(Thread.MutexKey) reflock = ({ _fetchlimit = 0 });    for (;;) {    reflock[0] = lock;    lock = 0;    if (!_sendexecute(0, reflock)) {    PD("Status_command_complete retry closemux %O\n", _portalname);    lock = closemux->lock();    continue;    }
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:1267:    datarowtypes = drowtypes;    _ddescribe->broadcast();    }       final void _preparebind(array dtoid) {    array(string|int) paramValues = _params ? _params[2] : ({});    if (sizeof(dtoid) != sizeof(paramValues))    SUSERERROR("Invalid number of bindings, expected %d, got %d\n",    sizeof(dtoid), sizeof(paramValues));    PD("PrepareBind\n"); -  Thread.MutexKey lock = _ddescribemux->lock(); +  void|Thread.MutexKey lock = _ddescribemux->lock();    if (!_portalname) {    _portalname    = (_unnamedportalkey = pgsqlsess.unnamedportalmux->trylock(1))    ? "" : PORTALPREFIX   #ifdef PG_DEBUG    + (string)(c->socket->query_fd()) + "_"   #endif    + String.int2hex(pgsqlsess.pportalcount++);    lock = 0;   #ifdef PG_DEBUGMORE
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:1584:    array(int) datarowtypes) {    _setrowdesc(datarowdesc, datarowtypes);    if (_tprepared) {    _tprepared.datarowdesc = datarowdesc;    _tprepared.datarowtypes = datarowtypes;    }    }       final void _parseportal() {    for (;;) { -  Thread.MutexKey lock = closemux->lock(); +  void|Thread.MutexKey lock = closemux->lock();    if ((syncparse || syncparse < 0 && pgsqlsess->wasparallelisable)    && !pgsqlsess->statementsinflight->drained()) {    lock = 0; // Unlock while we wait    PD("Commit waiting for statements to finish %d\n",    pgsqlsess->statementsinflight->_count);    catch(PT(pgsqlsess->statementsinflight->wait_till_drained()));    PD("Parseportal retry closemux %O\n", _portalname);    continue;    }    _state = PARSING;
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:2217: Inside #if defined(PG_DEBUG)
  #ifdef PG_DEBUG    if (!portal && datarowdebug) {    PD("%s rows %d\n", datarowdebug, datarowdebugcount);    datarowdebug = 0; datarowdebugcount = 0;    }   #endif   #ifdef PG_DEBUGMORE    showportalstack("LOOPTOP");   #endif    if (!sizeof(cr)) { // Preliminary check, fast path -  Thread.MutexKey lock = cr->fillreadmux->lock(); +  void|Thread.MutexKey lock = cr->fillreadmux->lock();    if (!sizeof(cr)) { // Check for real    if (!cr->fillread) {    lock = 0;    throw(MAGICTERMINATE); // Force proper termination    }    cr->procmsg = 1;    return; // Terminate thread, wait for callback    }    }    int msgtype = cr->read_int8();