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-02-04 23:58:10 +00:00
parent c398168403
commit 7800060e22
8 changed files with 26 additions and 27 deletions

View File

@ -2837,7 +2837,7 @@ static DWORD enterFastMutex(FAST_MUTEX* lpMutex, DWORD dwMilliseconds)
unlockSharedSection(lpSect);
// TODO actual timeout can be of any length
const DWORD tm = (dwMilliseconds == INFINITE) ? 5000 :
const DWORD tm = (dwMilliseconds == INFINITE) ? 5000 :
((dwMilliseconds > 5000) ? 5000 : dwMilliseconds);
const DWORD dwResult = WaitForSingleObject(lpMutex->hEvent, tm);

View File

@ -6622,7 +6622,7 @@ bool thread_db::checkCancelState(bool punt)
{
if ((!request ||
!(request->getStatement()->flags &
(JrdStatement::FLAG_INTERNAL | JrdStatement::FLAG_SYS_TRIGGER))) &&
(JrdStatement::FLAG_INTERNAL | JrdStatement::FLAG_SYS_TRIGGER))) &&
(!transaction || !(transaction->tra_flags & TRA_system)))
{
if (!punt)

View File

@ -206,7 +206,7 @@ inline bool checkLock(const Lock* l)
#endif
namespace {
// This class is used as a guard around long waiting call into LM and have
// This class is used as a guard around long waiting call into LM and have
// two purposes :
// - set and restore att_wait_lock while waiting inside the LM
// - set or clear and restore TDBB_wait_cancel_disable flag in dependence
@ -223,21 +223,16 @@ public:
Jrd::Attachment* att = m_tdbb->getAttachment();
m_save_lock = att->att_wait_lock;
m_cancel_disabled = (m_tdbb->tdbb_flags & TDBB_wait_cancel_disable);
m_cancel_disabled = (m_tdbb->tdbb_flags & TDBB_wait_cancel_disable);
m_tdbb->tdbb_flags |= TDBB_wait_cancel_disable;
if (!wait)
return;
switch (lock->lck_type)
if (lock->lck_type == LCK_tra)
{
case LCK_tra:
m_tdbb->tdbb_flags &= ~TDBB_wait_cancel_disable;
att->att_wait_lock = lock;
break;
default:
;
}
}
@ -246,7 +241,7 @@ public:
Jrd::Attachment* att = m_tdbb->getAttachment();
att->att_wait_lock = m_save_lock;
if (m_cancel_disabled)
if (m_cancel_disabled)
m_tdbb->tdbb_flags |= TDBB_wait_cancel_disable;
else
m_tdbb->tdbb_flags &= ~TDBB_wait_cancel_disable;
@ -379,7 +374,7 @@ bool LCK_cancel_wait(Jrd::Attachment* attachment)
**************************************
*
* Functional description
* Try to cancel waiting of attachment inside the LM
* Try to cancel waiting of attachment inside the LM.
*
**************************************/
Database *dbb = attachment->att_database;

View File

@ -363,8 +363,7 @@ string OPT_get_plan(thread_db* tdbb, const jrd_req* request, bool detailed)
**************************************
*
* Functional description
* Returns a formatted textual plan for all
* RecordSelExpr's in the specified request.
* Returns a formatted textual plan for all RseNode's in the specified request.
*
**************************************/
string plan;

View File

@ -127,7 +127,7 @@ void RecordSource::printInversion(thread_db* tdbb, const InversionNode* inversio
}
else
{
plan += (plan.length() ? ", " : "") + printName(tdbb, indexName.c_str());
plan += (plan.hasData() ? ", " : "") + printName(tdbb, indexName.c_str());
}
}
break;

View File

@ -165,7 +165,7 @@ private:
class DSQLParamsImpl : public Firebird::StackIface<TraceParams, FB_TRACE_PARAMS_VERSION>
{
public:
DSQLParamsImpl(Firebird::MemoryPool &pool, const Firebird::Array<dsql_par*>* params) :
DSQLParamsImpl(Firebird::MemoryPool& pool, const Firebird::Array<dsql_par*>* params) :
m_params(params),
m_descs(pool)
{}
@ -191,7 +191,7 @@ private:
class TraceFailedSQLStatement : public Firebird::StackIface<TraceSQLStatement, FB_TRACE_SQL_VERSION>
{
public:
TraceFailedSQLStatement(Firebird::string &text) :
TraceFailedSQLStatement(Firebird::string& text) :
m_text(text)
{}
@ -334,7 +334,7 @@ private:
class TraceInitInfoImpl : public Firebird::StackIface<TraceInitInfo, FB_TRACE_INIT_INFO_VERSION>
{
public:
TraceInitInfoImpl(const Firebird::TraceSession &session, const Attachment* att,
TraceInitInfoImpl(const Firebird::TraceSession& session, const Attachment* att,
const char* filename) :
m_session(session),
m_trace_conn(att),

View File

@ -835,7 +835,7 @@ bool LockManager::cancelWait(SRQ_PTR owner_offset)
*
* Functional description
* Wakeup waiting owner to make it check if wait should be cancelled.
* As this routine could be called asyncronous, take extra care and
* As this routine could be called asyncronous, take extra care and
* don't trust the input params blindly.
*
**************************************/
@ -847,12 +847,13 @@ bool LockManager::cancelWait(SRQ_PTR owner_offset)
Firebird::MutexLockGuard guard(m_localMutex);
acquire_shmem(DUMMY_OWNER);
own* owner = (own*) SRQ_ABS_PTR(owner_offset);
if (owner->own_type == type_own)
post_wakeup(owner);
release_shmem(DUMMY_OWNER);
return true;
}
@ -4029,11 +4030,11 @@ USHORT LockManager::wait_for_request(Database* database, lrq* request, SSHORT lc
// See if we've waited beyond the lock timeout -
// if so we mark our own request as rejected
// !!! this will be changed to have no dependency on thread_db !!!
const bool cancelled = JRD_get_thread_data()->checkCancelState(false);
if (cancelled || lck_wait < 0 && lock_timeout <= current_time)
// !!! this will be changed to have no dependency on thread_db !!!
const bool cancelled = JRD_get_thread_data()->checkCancelState(false);
if (cancelled || (lck_wait < 0 && lock_timeout <= current_time))
{
// We're going to reject our lock - it's the callers responsibility
// to do cleanup and make sure post_pending() is called to wakeup
@ -4041,7 +4042,7 @@ USHORT LockManager::wait_for_request(Database* database, lrq* request, SSHORT lc
request->lrq_flags |= LRQ_rejected;
request->lrq_flags &= ~LRQ_pending;
lock->lbl_pending_lrq_count--;
// and test - may be timeout due to missing process to deliver request
probe_processes();
release_shmem(owner_offset);

View File

@ -5421,6 +5421,7 @@ void Worker::setState(const bool active)
bool Worker::wakeUp()
{
MutexLockGuard reqQueGuard(request_que_mutex);
#ifdef _DEBUG
int cnt = 0;
for (server_req_t* req = request_que; req; req = req->req_next)
@ -5437,6 +5438,7 @@ bool Worker::wakeUp()
return true;
MutexLockGuard guard(m_mutex);
if (m_idleWorkers)
{
Worker* idle = m_idleWorkers;
@ -5444,8 +5446,10 @@ bool Worker::wakeUp()
idle->m_sem.release();
return true;
}
if (m_cntAll >= ports_active + ports_pending)
return true;
return (m_cntAll >= MAX_THREADS);
}
@ -5513,7 +5517,7 @@ void Worker::start(USHORT flags)
Thread::start(loopThread, (void*)(IPTR) flags, THREAD_medium);
++m_cntAll;
}
catch(const Exception&)
catch (const Exception&)
{
if (!m_cntAll)
{