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

Some thread safety

This commit is contained in:
hvlad 2008-12-12 10:06:32 +00:00
parent e58d227427
commit a93f6c32f0
2 changed files with 9 additions and 4 deletions

View File

@ -7024,11 +7024,11 @@ ISC_STATUS FB_CANCEL_OPERATION(ISC_STATUS* user_status, Rdb** db_handle, USHORT
**************************************/ **************************************/
Rdb* rdb = *db_handle; Rdb* rdb = *db_handle;
CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle); CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle);
rem_port* port = rdb->rdb_port; RemPortPtr port(rdb->rdb_port);
if (kind == fb_cancel_abort) if (kind == fb_cancel_abort)
{ {
rdb->rdb_port->force_close(); port->force_close();
user_status[0] = isc_arg_gds; user_status[0] = isc_arg_gds;
user_status[1] = FB_SUCCESS; user_status[1] = FB_SUCCESS;

View File

@ -59,6 +59,7 @@ const char* EVENT_PIPE_SUFFIX = "event";
Firebird::AtomicCounter event_counter; Firebird::AtomicCounter event_counter;
static Firebird::GlobalPtr<PortsCleanup> wnet_ports; static Firebird::GlobalPtr<PortsCleanup> wnet_ports;
static Firebird::GlobalPtr<Firebird::Mutex> init_mutex;
static bool wnet_initialized = false; static bool wnet_initialized = false;
static bool wnet_shutdown = false; static bool wnet_shutdown = false;
@ -564,8 +565,12 @@ static rem_port* alloc_port( rem_port* parent)
if (!wnet_initialized) if (!wnet_initialized)
{ {
wnet_initialized = true; Firebird::MutexLockGuard guard(init_mutex);
fb_shutdown_callback(0, cleanup_ports, fb_shut_postproviders, 0); if (!wnet_initialized)
{
wnet_initialized = true;
fb_shutdown_callback(0, cleanup_ports, fb_shut_postproviders, 0);
}
} }
rem_port* port = new rem_port(rem_port::PIPE, BUFFER_SIZE * 2); rem_port* port = new rem_port(rem_port::PIPE, BUFFER_SIZE * 2);