Hello soci development team,

first of all: thanks for this great peace of software!

I hope this is the right way to ask this question.


In my little multi-threaded server-software using soci as abstraction
layer for sqlite and/or postgres I am fighting a deadlock-scenario with
pooled sessions.

I wonder if there's a non-blocking way to get a pooled session (possibly
using try_lease()).

My next step would be to add another session constructor to session.cpp
like this:

--- snip ---
session::session(connection_pool & pool, int timeout)
{
    if (pool.try_lease(poolPosition_, timeout))
    {
        session & pooledSession = pool.at(poolPosition_);
        isFromPool_ = true;
        pool_ = pool;

        once.set_session(&pooledSession);
        prepare.set_session(&pooledSession);
        backEnd_ = pooledSession.get_backend();
    }
    else
    {
      once = this;
      prepare = this;
      logStream_ = NULL;
      lastFactory_ = NULL;
      uppercaseColumnNames_ = false;
      backEnd_ = NULL;
      isFromPool_ = false;
      pool_ = NULL;
      throw soci_error("No free pooled session in specified time.");
    }

}
--- snap ---

but working on a fork is not my first choice.

So do you see a better solution, did I miss anything or is it a seldom
use-case ?

thanks for your help,

Andre

------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
_______________________________________________
soci-devel mailing list
soci-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/soci-devel

Reply via email to