Branch: Tag:

2008-07-14

2008-07-14 14:20:06 by Stephen R. van den Berg <srb@cuci.nl>

pgsql, fixed ERROR macro, added mutexprofiling

Rev: lib/modules/Sql.pmod/pgsql.pike:1.2

25:   //#define DEBUGMORE 1      #ifdef DEBUG - #define PD(X ...) werror(X) + #define PD(X ...) werror(X)   #define UNBUFFEREDIO 1 // Make all IO unbuffered   #else   #undef DEBUGMORE   #define PD(X ...)   #endif -  + //#define NO_LOCKING 1 // This breaks the driver, do not enable, +  // only for benchmarking mutex performance      #define FETCHLIMIT 1024 // Initial upper limit on the    // number of rows to fetch across the
52:   #define MARKERROR ">>>>" // foldeditors from recognising   #define MARKEND "\n}""}""}""}" // it as a fold    - #define ERROR(X ...) predef::error + #define ERROR(X ...) predef::error(X)      pgsql_result _portal;   int _nextportal;
1397:   int _fetchlimit;      private mapping tprepared; + #ifdef NO_LOCKING + int _qmtxkey; + #else   Thread.MutexKey _qmtxkey; -  + #endif      string query;   string _portalname;
1512:   }      private void steallock() { + #ifndef NO_LOCKING    PD("Going to steal oldportal %d\n",!!pgsqlsession._portal);    Thread.MutexKey stealmtxkey = stealmutex.lock();    do
1536:    break;    }    while(!(_qmtxkey=querymutex.trylock())); + #else +  PD("Skipping lock\n"); +  _qmtxkey=1; + #endif    pgsqlsession._portal=this;    PD("Stealing successful\n");   }
1550:    releasesession();    return UNDEFINED;    } + #ifndef NO_LOCKING    Thread.MutexKey fetchmtxkey = fetchmutex.lock(); -  + #endif    if(!buffer && sizeof(_datarows))    return getdatarow();    mixed err;