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

Do not hold mutex more then needed

This commit is contained in:
alexpeshkoff 2008-02-02 17:42:32 +00:00
parent e75ce2e528
commit 8bdc06af57

View File

@ -865,11 +865,11 @@ ISC_STATUS callback_execute_immediate( ISC_STATUS* status,
try try
{ {
Firebird::MutexLockGuard guard(databases_mutex);
dsql_dbb* database = NULL; dsql_dbb* database = NULL;
// 1. Locate why_db_handle, corresponding to jrd_database_handle // 1. Locate why_db_handle, corresponding to jrd_database_handle
{ // guard scope
Firebird::MutexLockGuard guard(databases_mutex);
for (database = databases; database; database = database->dbb_next) for (database = databases; database; database = database->dbb_next)
{ {
if (YValve::translate<YValve::Attachment>(&database->dbb_database_handle)->handle == jrd_attachment_handle) if (YValve::translate<YValve::Attachment>(&database->dbb_database_handle)->handle == jrd_attachment_handle)
@ -877,6 +877,7 @@ ISC_STATUS callback_execute_immediate( ISC_STATUS* status,
break; break;
} }
} }
}
if (!database) if (!database)
{ {
Firebird::status_exception::raise(isc_bad_db_handle, isc_arg_end); Firebird::status_exception::raise(isc_bad_db_handle, isc_arg_end);