Home > Back-end >  C multithreaded access accounted connection pool connection whether to add a mutex
C multithreaded access accounted connection pool connection whether to add a mutex

Time:10-06

With ACE development, accounted to create a connection pool first,
Try
{
Env_=Environment: : createEnvironment ((Environment: : Mode ((Environment: : OBJECT | Environment: : THREADED_MUTEXED))));
if (! Env_)
{
return false;
}
ConnPool_=env_ - & gt; CreateStatelessConnectionPool (szpoolUserName,
SzpoolPassword,
SzconnectString,
NmaxConn,
NminConn,
NincrConn,
StatelessConnectionPool: : HOMOGENEOUS);
if (! ConnPool_)
{
return false;
}
ConnPool_ - & gt; SetTimeOut (1000);

StatelessConnectionPool: : BusyOption BusyOption=StatelessConnectionPool: : FORCEGET;
ConnPool_ - & gt; SetBusyOption (BusyOption);
Then in the thread when acquiring the connection
The Connection * con;
{
ACE_Guard & lt; ACE_Thread_Mutex & gt; Guard (_occiMutex); (whether to add a mutex)
Con=_occipool - & gt; GetConnection ();
}

CodePudding user response:

Prawns, give some opinions

CodePudding user response:

To a great god...

CodePudding user response:

http://blog.chinaunix.net/uid-603209-id-2088184.html
Use this method to use

CodePudding user response:


Thank you very much...
See

CodePudding user response:

Want to use the connection pool,
  • Related