mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
postgres connection pool: fix race when a connection is already acquired while pool is still being constructed
This commit is contained in:
parent
ecbe0e43f4
commit
1e96813132
@ -14,14 +14,23 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "qgspostgresconnpool.h"
|
||||
|
||||
#include "qgspostgresconn.h"
|
||||
|
||||
|
||||
QgsPostgresConnPool* QgsPostgresConnPool::instance()
|
||||
{
|
||||
static QgsPostgresConnPool sInstance;
|
||||
return &sInstance;
|
||||
static QgsPostgresConnPool *sInstance = 0;
|
||||
|
||||
if ( !sInstance )
|
||||
{
|
||||
static QMutex m;
|
||||
m.lock();
|
||||
if ( !sInstance )
|
||||
sInstance = new QgsPostgresConnPool();
|
||||
m.unlock();
|
||||
}
|
||||
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
QgsPostgresConnPool::QgsPostgresConnPool() : QgsConnectionPool<QgsPostgresConn*, QgsPostgresConnPoolGroup>()
|
||||
|
Loading…
x
Reference in New Issue
Block a user