Branch: Tag:

2014-11-10

2014-11-10 16:08:19 by Stephen R. van den Berg <srb@cuci.nl>

pgsql: Reduce the number of dynamically created threads.

This patch pushes most of the dynamically created threads into the
running local_backend. It specifically does not push the gotdatarowdesc
one to avoid deadlocks.

591:    }   }    + protected inline mixed callout(function(mixed ...:void) f, +  float|int delay,mixed ... args) { +  return .pgsql_util.local_backend->call_out(f,delay,@args); + } +    final void _processloop(.pgsql_util.PGassist ci) {    int terminating=0;    int|.pgsql_util.pgsql_result portal;
839:   #endif    if(portal._tprepared)    portal._tprepared.datatypeoid=a; -  Thread.Thread(portal->_preparebind,a); +  callout(portal->_preparebind,0,a);    break;    }    case 'T': {
1280:    lock=0;    PD("Schedule reconnect in %ds\n",tdelay);    _delayederror=0; -  .pgsql_util.local_backend->call_out(reconnect,tdelay,1); +  callout(reconnect,tdelay,1);    } else if(err)    _delayederror=err;   }
1469:    array cb;    if((cb=notifylist[condition]||notifylist[""])    && (pid!=backendpid || sizeof(cb)>1 && cb[1])) -  Thread.Thread(cb[0],pid,condition,extrainfo,@cb[2..]); +  callout(cb[0],0,pid,condition,extrainfo,@cb[2..]);   }      //! @returns