8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 08:43:03 +01:00

Make the mutex protection available for [super-]classic builds.

This commit is contained in:
dimitr 2008-02-20 15:43:31 +00:00
parent e41a534960
commit 0c7959cfd0

View File

@ -102,26 +102,18 @@ static dsql_sym* lookup_symbol(dsql_dbb*, USHORT, const char*, SYM_TYPE, USHORT
static dsql_sym* lookup_symbol(dsql_dbb*, const dsql_str*, SYM_TYPE, USHORT = 0); static dsql_sym* lookup_symbol(dsql_dbb*, const dsql_str*, SYM_TYPE, USHORT = 0);
namespace { namespace {
#ifdef SUPERSERVER Firebird::GlobalPtr<Firebird::Mutex> mutex; // Metadata mutex
Firebird::GlobalPtr<Firebird::Mutex> rec_mutex; // Metadata mutex
class RecMutexHolder { class MutexHolder {
public: public:
explicit RecMutexHolder(dsql_req* request) { explicit MutexHolder(dsql_req* request) {
DsqlCheckout dcoHolder(request->req_dbb); DsqlCheckout dcoHolder(request->req_dbb);
rec_mutex->enter(); mutex->enter();
} }
~RecMutexHolder() { ~MutexHolder() {
rec_mutex->leave(); mutex->leave();
} }
}; };
#else
class RecMutexHolder {
public:
explicit RecMutexHolder(dsql_req* request) { }
~RecMutexHolder() { }
};
#endif
} }
@ -143,7 +135,7 @@ void METD_drop_collation(dsql_req* request, const dsql_str* name)
* accessing it. * accessing it.
* *
**************************************/ **************************************/
RecMutexHolder holder(request); MutexHolder holder(request);
// If the symbol wasn't defined, we've got nothing to do // If the symbol wasn't defined, we've got nothing to do
dsql_sym* symbol = lookup_symbol(request->req_dbb, name, SYM_intlsym_collation, 0); dsql_sym* symbol = lookup_symbol(request->req_dbb, name, SYM_intlsym_collation, 0);
@ -179,7 +171,7 @@ void METD_drop_function(dsql_req* request, const dsql_str* name)
* accessing it. * accessing it.
* *
**************************************/ **************************************/
RecMutexHolder holder(request); MutexHolder holder(request);
// If the symbol wasn't defined, we've got nothing to do // If the symbol wasn't defined, we've got nothing to do
@ -217,7 +209,7 @@ void METD_drop_procedure(dsql_req* request, const dsql_str* name)
* accessing it. * accessing it.
* *
**************************************/ **************************************/
RecMutexHolder holder(request); MutexHolder holder(request);
// If the symbol wasn't defined, we've got nothing to do // If the symbol wasn't defined, we've got nothing to do
@ -254,7 +246,7 @@ void METD_drop_relation(dsql_req* request, const dsql_str* name)
* accessing it. * accessing it.
* *
**************************************/ **************************************/
RecMutexHolder holder(request); MutexHolder holder(request);
// If the symbol wasn't defined, we've got nothing to do // If the symbol wasn't defined, we've got nothing to do
@ -288,7 +280,7 @@ dsql_intlsym* METD_get_collation(dsql_req* request,
* If it doesn't exist, return NULL. * If it doesn't exist, return NULL.
* *
**************************************/ **************************************/
RecMutexHolder holder(request); MutexHolder holder(request);
// Start by seeing if symbol is already defined // Start by seeing if symbol is already defined
@ -493,7 +485,7 @@ dsql_intlsym* METD_get_charset(dsql_req* request, USHORT length, const char* nam
* If it doesn't exist, return NULL. * If it doesn't exist, return NULL.
* *
**************************************/ **************************************/
RecMutexHolder holder(request); MutexHolder holder(request);
// Start by seeing if symbol is already defined // Start by seeing if symbol is already defined
@ -945,7 +937,7 @@ dsql_udf* METD_get_function(dsql_req* request, const dsql_str* name)
dsql_nod* udf_param_node; dsql_nod* udf_param_node;
dsql_nod** ptr; dsql_nod** ptr;
RecMutexHolder holder(request); MutexHolder holder(request);
// Start by seeing if symbol is already defined // Start by seeing if symbol is already defined
@ -1217,7 +1209,7 @@ dsql_prc* METD_get_procedure(dsql_req* request, const dsql_str* name)
return temp; return temp;
} }
RecMutexHolder holder(request); MutexHolder holder(request);
// Start by seeing if symbol is already defined // Start by seeing if symbol is already defined
@ -1435,7 +1427,7 @@ dsql_rel* METD_get_relation(dsql_req* request, const dsql_str* name)
tsql* tdsql = DSQL_get_thread_data(); tsql* tdsql = DSQL_get_thread_data();
RecMutexHolder holder(request); MutexHolder holder(request);
// Start by seeing if symbol is already defined // Start by seeing if symbol is already defined