8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 21:23:03 +01:00
This commit is contained in:
asfernandes 2011-03-18 02:00:11 +00:00
parent f8c690835e
commit 6534883d94
6 changed files with 33 additions and 21 deletions

View File

@ -247,12 +247,12 @@ bool touchFile(const char* pathname)
FILETIME ft;
SYSTEMTIME st;
HANDLE hFile = CreateFile(pathname,
GENERIC_READ | FILE_WRITE_ATTRIBUTES,
FILE_SHARE_READ | FILE_SHARE_WRITE,
ISC_get_security_desc(),
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
HANDLE hFile = CreateFile(pathname,
GENERIC_READ | FILE_WRITE_ATTRIBUTES,
FILE_SHARE_READ | FILE_SHARE_WRITE,
ISC_get_security_desc(),
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
0);
if (hFile == INVALID_HANDLE_VALUE)
return false;

View File

@ -703,8 +703,8 @@ public:
return NULL;
}
virtual int FB_CARG upgradeInterface(Interface* toUpgrade, int desiredVersion,
void* missingFunctionClass)
virtual int FB_CARG upgradeInterface(Interface* /*toUpgrade*/, int /*desiredVersion*/,
void* /*missingFunctionClass*/)
{
fb_assert(false);
return 0;

View File

@ -1044,7 +1044,7 @@ static idx_e check_duplicates(thread_db* tdbb,
tdbb->tdbb_status_vector[1] == isc_lock_timeout);
// the above errors are not thrown but returned silently
if (lock_error)
if (lock_error)
{
fb_utils::init_status(tdbb->tdbb_status_vector);
}

View File

@ -372,7 +372,7 @@ struct TimerEntry
Thread::start(timeThread, 0, 0, &timerThreadHandle);
}
static void cleanup(void);
static void cleanup();
};
typedef SortedArray<TimerEntry, InlineStorage<TimerEntry, 64>, TimerDelay, TimerEntry> TimerQueue;
@ -380,7 +380,7 @@ GlobalPtr<TimerQueue> timerQueue;
InitMutex<TimerEntry> timerHolder;
void TimerEntry::cleanup(void)
void TimerEntry::cleanup()
{
MutexLockGuard guard(timerAccess);
@ -431,16 +431,19 @@ THREAD_ENTRY_DECLARE TimerEntry::timeThread(THREAD_ENTRY_PARAM)
while (!stopThread)
{
TimerDelay microSeconds = 0;
{
MutexLockGuard guard(timerAccess);
const TimerDelay cur = curTime();
while (timerQueue->getCount() > 0)
{
TimerEntry e(timerQueue->operator[](0));
if (e.fireTime <= cur)
{
timerQueue->remove((size_t)0);
timerQueue->remove((size_t) 0);
e.timer->handler();
e.timer->release();
}

View File

@ -349,6 +349,7 @@ namespace
: counter(0), waitsOn(NULL)
{ }
};
struct CountByTypeArray
{
CountByTypeArray(MemoryPool&)
@ -892,6 +893,7 @@ void PluginManager::waitForType(unsigned int typeThatMustGoAway)
Semaphore sem;
Semaphore* semPtr = NULL;
{ // guard scope
MutexLockGuard g(plugins->mutex);

View File

@ -4181,7 +4181,7 @@ ISC_STATUS API_ROUTINE isc_reconnect_transaction(ISC_STATUS* user_status,
*
**************************************/
StatusVector status(user_status);
ITransaction* tra = 0;
ITransaction* tra = NULL;
try
{
@ -4387,9 +4387,9 @@ ISC_STATUS API_ROUTINE isc_rollback_transaction(ISC_STATUS* user_status,
if (sub->providerInterface)
{
sub->providerInterface->rollback(&status);
if ((!status.isSuccess()) &&
( !is_network_error(status) ||
(transaction->flags & HANDLE_TRANSACTION_limbo) ) )
if (!status.isSuccess() &&
(!is_network_error(status) ||
(transaction->flags & HANDLE_TRANSACTION_limbo)))
{
return status[1];
}
@ -5804,15 +5804,21 @@ int API_ROUTINE fb_shutdown(unsigned int timeout, const int reason)
}
// Close all known interfaces from providers ...
{ // guard scope
WriteLockGuard sync(handleMappingLock);
HandleMapping::Accessor a(&handleMapping);
if (a.getFirst()) do
if (a.getFirst())
{
BaseHandle* handle = a.current();
handle->releaseAll();
} while (a.getNext());
do
{
BaseHandle* handle = a.current();
handle->releaseAll();
} while (a.getNext());
}
}
// ... and wait for all providers to go away
PluginManager::waitForType(PluginType::Provider);
@ -5897,10 +5903,11 @@ ISC_STATUS API_ROUTINE fb_ping(ISC_STATUS* user_status, FB_API_HANDLE* db_handle
attachment->providerInterface->ping(&status);
if (!status.isSuccess())
{
if (!attachment->status.getError())
if (!attachment->status.getError())
{
attachment->status.save(status);
}
{
MutexLockGuard guard(*attachment->getProviderInterfaceCleanupMutex());
if (attachment->providerInterface)