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

version» Context lines:

pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:1777:    if (callback)    Thread.Thread(run_result_array_cb, callback, args);    }      };      class proxy {    final int _fetchlimit = FETCHLIMIT;    final MUTEX unnamedportalmux;    final MUTEX unnamedstatement; -  private Thread.MutexKey termlock; +  private Thread.MutexKey|int termlock;    final Thread.ResourceCount portalsinflight, statementsinflight;    final int(0..1) wasparallelisable;    final int(0..1) intransaction;       final conxion c;    private string cancelsecret;    private int backendpid;    final int(-128..127) backendstatus;    final mapping(string:mixed) options;    private array(string) lastmessage = ({});
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:1953:    if (database)    plugbuffer->add("database\0", database, 0);    foreach (options - censoroptions; string name; mixed value)    plugbuffer->add(name, 0, (string)value, 0);    plugbuffer->add_int8(0);    PD("%O\n", (string)plugbuffer);    void|bufcon|conxsess cs;    if (catch(cs = ci->start())) {    destruct(waitforauthready);    unnamedstatement = 0; -  termlock = 0; +  termlock = 1;    return;    } else {    CHAIN(cs)->add_hstring(plugbuffer, 4, 4);    cs->sendcmd(SENDOUT);    }    } // Do not flush at this point, PostgreSQL 9.4 disapproves    procmessage();    }       private void stasherror(int|object portal, mixed err) {
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:2661:    }    PD("Closing database processloop %s\n", err ? describe_backtrace(err) : "");    delayederror = err;    if (objectp(portal)) {   #ifdef PG_DEBUG    showportal(0);   #endif    portal->_purgeportal();    }    destruct(waitforauthready); -  termlock = 0; +  termlock = 1;    if (err && !stringp(err))    throw(err);    };    catch {    unnamedstatement = 0; -  termlock = 0; +  termlock = 1;    if (err) {    PD("Terminating processloop due to %s\n", describe_backtrace(err));    delayederror = err;    }    destruct(waitforauthready);    c->purge();    };    }       final void close() {    throwdelayederror(this);    {    Thread.MutexKey lock; -  if (unnamedstatement) +  if (unnamedstatement && !termlock)    termlock = unnamedstatement->lock(1);    foreach (c->runningportals; sql_result result; )    if (result->_state < CLOSED)    catch(result->status_command_complete());    if (c) // Prevent trivial backtraces    c->close();    if (unnamedstatement)    lock = unnamedstatement->lock(1);    if (c)    c->purge();