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

Port forward fix for bug CORE-3636 : Firebird 2.5.1 server crashes with Trace API

This commit is contained in:
hvlad 2011-10-16 14:10:48 +00:00
parent ba1a02f3f5
commit 862a9e0694
2 changed files with 21 additions and 6 deletions

View File

@ -71,17 +71,18 @@ void checkFileError(const char* filename, const char* operation, ISC_STATUS iscE
// the same as GetLastError() codes
const char* strErr = strerror(errno);
ERR_post(Arg::Gds(isc_io_error) << Arg::Str(operation) << Arg::Str(filename) <<
Arg::Gds(iscError) << Arg::Str(strErr));
(Arg::Gds(isc_io_error) << Arg::Str(operation) << Arg::Str(filename) <<
Arg::Gds(iscError) << Arg::Str(strErr)).raise();
#else
ERR_post(Arg::Gds(isc_io_error) << Arg::Str(operation) << Arg::Str(filename) <<
Arg::Gds(iscError) << SYS_ERR(errno));
(Arg::Gds(isc_io_error) << Arg::Str(operation) << Arg::Str(filename) <<
Arg::Gds(iscError) << SYS_ERR(errno)).raise();
#endif
}
ConfigStorage::ConfigStorage()
: timer(new TouchFile),
m_recursive(0)
m_recursive(0),
m_mutexTID(0)
{
m_cfg_file = -1;
m_dirty = false;
@ -286,10 +287,19 @@ void ConfigStorage::checkFile()
void ConfigStorage::acquire()
{
fb_assert(m_recursive >= 0);
const FB_THREAD_ID currTID = getThreadId();
if (m_recursive++ == 0)
if (m_mutexTID == currTID)
m_recursive++;
else
{
mutexLock();
fb_assert(m_recursive == 0);
m_recursive = 1;
fb_assert(m_mutexTID == 0);
m_mutexTID = currTID;
}
}
@ -297,9 +307,13 @@ void ConfigStorage::release()
{
fb_assert(m_recursive > 0);
const FB_THREAD_ID currTID = getThreadId();
fb_assert(m_mutexTID == currTID);
if (--m_recursive == 0)
{
checkDirty();
m_mutexTID = 0;
mutexUnlock();
}
}

View File

@ -117,6 +117,7 @@ private:
bool getItemLength(ITEM& tag, ULONG& len);
int m_recursive;
FB_THREAD_ID m_mutexTID;
int m_cfg_file;
bool m_dirty;
};