8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 16:03:02 +01:00

Fixed CORE-4211: Embedded engine hangs for 5 seconds when closing

This commit is contained in:
alexpeshkoff 2013-09-09 11:03:46 +00:00
parent edd2f6945b
commit a3abde8118
4 changed files with 12 additions and 13 deletions

View File

@ -47,8 +47,9 @@ class InstanceControl
public:
enum DtorPriority
{
STARTING_PRIORITY,
STARTING_PRIORITY, // Not to be used out of class InstanceControl
PRIORITY_DETECT_UNLOAD,
PRIORITY_DELETE_FIRST,
PRIORITY_REGULAR,
PRIORITY_TLS_KEY
};

View File

@ -125,23 +125,22 @@ private:
};
class StorageInstance : private Firebird::InstanceControl
class StorageInstance
{
private:
Firebird::Mutex initMtx;
ConfigStorage* storage;
public:
void dtor()
{
delete storage;
storage = 0;
}
StorageInstance() :
StorageInstance(Firebird::MemoryPool&) :
storage(NULL)
{}
~StorageInstance()
{
delete storage;
}
ConfigStorage* getStorage()
{
if (!storage)
@ -150,7 +149,6 @@ public:
if (!storage)
{
storage = new ConfigStorage;
new Firebird::InstanceControl::InstanceLink<StorageInstance>(this);
}
}
return storage;

View File

@ -70,7 +70,7 @@ namespace
namespace Jrd {
StorageInstance TraceManager::storageInstance;
GlobalPtr<StorageInstance, InstanceControl::PRIORITY_DELETE_FIRST> TraceManager::storageInstance;
TraceManager::Factories* TraceManager::factories = NULL;
GlobalPtr<Mutex> TraceManager::init_factories_mtx;
volatile bool TraceManager::init_factories;

View File

@ -58,7 +58,7 @@ public:
~TraceManager();
static ConfigStorage* getStorage()
{ return storageInstance.getStorage(); }
{ return storageInstance->getStorage(); }
static size_t pluginsCount()
{ return factories->getCount(); }
@ -223,7 +223,7 @@ private:
TraceSQLStatement* statement,
bool started, ntrace_result_t req_result);
static StorageInstance storageInstance;
static Firebird::GlobalPtr<StorageInstance, Firebird::InstanceControl::PRIORITY_DELETE_FIRST> storageInstance;
ULONG changeNumber;
};