From ee34db7e20b15af744950dbdbcfc7a87f0803170 Mon Sep 17 00:00:00 2001 From: brodsom Date: Sat, 15 May 2004 00:58:46 +0000 Subject: [PATCH] Macro cleaning (THREAD_*) --- src/alice/alice.cpp | 8 +- src/alice/all.cpp | 3 +- src/dsql/alld.cpp | 12 +- src/dsql/ddl.cpp | 6 +- src/dsql/dsql.cpp | 134 ++++++++-------- src/dsql/metd.epp | 200 +++++++++++------------ src/ipserver/ipclient.cpp | 4 +- src/jrd/cch.cpp | 96 +++++------ src/jrd/dfw.epp | 10 +- src/jrd/dyn.epp | 4 +- src/jrd/event.cpp | 8 +- src/jrd/execute_statement.cpp | 20 +-- src/jrd/fun.epp | 42 ++--- src/jrd/isc_sync.cpp | 4 +- src/jrd/jrd.cpp | 24 +-- src/jrd/met.epp | 14 +- src/jrd/nbak.cpp | 18 +-- src/jrd/os/win32/ibinitdll.cpp | 2 +- src/jrd/os/win32/thd_priority.cpp | 7 +- src/jrd/pwd.cpp | 18 +-- src/jrd/qatest.cpp | 4 +- src/jrd/shut.cpp | 4 +- src/jrd/sort.cpp | 32 ++-- src/jrd/svc.cpp | 96 +++++------ src/jrd/thd.h | 81 +++++++--- src/jrd/tra.cpp | 4 +- src/jrd/val.cpp | 6 +- src/jrd/vio.cpp | 40 ++--- src/jrd/why.cpp | 6 +- src/lock/lock.cpp | 10 +- src/remote/inet.cpp | 62 +++---- src/remote/inet_server.cpp | 10 +- src/remote/interface.cpp | 20 +-- src/remote/os/win32/cntl.cpp | 10 +- src/remote/os/win32/srvr_w32.cpp | 18 +-- src/remote/os/win32/window.cpp | 2 +- src/remote/os/win32/winmain.cpp | 4 +- src/remote/os/win32/wnet.cpp | 36 ++--- src/remote/server.cpp | 258 +++++++++++++++--------------- src/remote/xnet.cpp | 26 +-- 40 files changed, 698 insertions(+), 665 deletions(-) diff --git a/src/alice/alice.cpp b/src/alice/alice.cpp index 08f3acd1dc..5bd596f584 100644 --- a/src/alice/alice.cpp +++ b/src/alice/alice.cpp @@ -24,7 +24,7 @@ // //____________________________________________________________ // -// $Id: alice.cpp,v 1.61 2004-05-03 21:39:59 brodsom Exp $ +// $Id: alice.cpp,v 1.62 2004-05-15 00:52:43 brodsom Exp $ // // 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE" // conditionals, as the engine now fully supports @@ -42,14 +42,14 @@ #include #include +#include "../jrd/ibase.h" +#include "../jrd/common.h" +#include "../jrd/license.h" #include "../alice/alice.h" #include "../alice/aliceswi.h" #include "../alice/all.h" #include "../alice/all_proto.h" #include "../alice/exe_proto.h" -#include "../jrd/ibase.h" -#include "../jrd/common.h" -#include "../jrd/license.h" #include "../jrd/msg_encode.h" #include "../jrd/gds_proto.h" #include "../jrd/svc.h" diff --git a/src/alice/all.cpp b/src/alice/all.cpp index ae70eb4da1..7e757e13cb 100644 --- a/src/alice/all.cpp +++ b/src/alice/all.cpp @@ -24,10 +24,11 @@ // //____________________________________________________________ // -// $Id: all.cpp,v 1.20 2004-04-28 21:52:39 brodsom Exp $ +// $Id: all.cpp,v 1.21 2004-05-15 00:52:07 brodsom Exp $ // #include "firebird.h" +#include "../jrd/common.h" #include "../alice/all.h" #include "../alice/alice.h" #include "../jrd/thd_proto.h" diff --git a/src/dsql/alld.cpp b/src/dsql/alld.cpp index 2548169ccd..a58407733d 100644 --- a/src/dsql/alld.cpp +++ b/src/dsql/alld.cpp @@ -27,27 +27,27 @@ V4 Multi-threading changes. -- direct calls to gds__ () & isc_ () entry points - THREAD_EXIT; + THREAD_EXIT(); gds__ () or isc_ () call. - THREAD_ENTER; + THREAD_ENTER(); -- calls through embedded GDML. the following protocol will be used. Care should be taken if nested FOR loops are added. - THREAD_EXIT; // last statment before FOR loop + THREAD_EXIT(); // last statment before FOR loop FOR ............... - THREAD_ENTER; // First statment in FOR loop + THREAD_ENTER(); // First statment in FOR loop .....some C code.... .....some C code.... - THREAD_EXIT; // last statment in FOR loop + THREAD_EXIT(); // last statment in FOR loop END_FOR; - THREAD_ENTER; // First statment after FOR loop + THREAD_ENTER(); // First statment after FOR loop ***************************************************************/ #include "firebird.h" diff --git a/src/dsql/ddl.cpp b/src/dsql/ddl.cpp index 595ad6a637..1824bd600b 100644 --- a/src/dsql/ddl.cpp +++ b/src/dsql/ddl.cpp @@ -20,7 +20,7 @@ * All Rights Reserved. * Contributor(s): ______________________________________. * - * $Id: ddl.cpp,v 1.99 2004-05-09 05:47:46 robocop Exp $ + * $Id: ddl.cpp,v 1.100 2004-05-15 00:53:11 brodsom Exp $ * 2001.5.20 Claudio Valderrama: Stop null pointer that leads to a crash, * caused by incomplete yacc syntax that allows ALTER DOMAIN dom SET; * @@ -274,14 +274,14 @@ void DDL_execute(dsql_req* request) const USHORT length = request->req_blr_data.getCount(); - THREAD_EXIT; + THREAD_EXIT(); const ISC_STATUS s = isc_ddl(tdsql->tsql_status, &request->req_dbb->dbb_database_handle, &request->req_trans, length, (const char*)(request->req_blr_data.begin())); - THREAD_ENTER; + THREAD_ENTER(); // for delete & modify, get rid of the cached relation metadata diff --git a/src/dsql/dsql.cpp b/src/dsql/dsql.cpp index 8e35744c2f..235c8b1634 100644 --- a/src/dsql/dsql.cpp +++ b/src/dsql/dsql.cpp @@ -37,27 +37,27 @@ V4 Multi-threading changes. -- direct calls to gds__ () & isc_ () entrypoints - THREAD_EXIT; + THREAD_EXIT(); gds__ () or isc_ () call. - THREAD_ENTER; + THREAD_ENTER(); -- calls through embedded GDML. the following protocol will be used. Care should be taken if nested FOR loops are added. - THREAD_EXIT; // last statement before FOR loop + THREAD_EXIT(); // last statement before FOR loop FOR ............... - THREAD_ENTER; // First statement in FOR loop + THREAD_ENTER(); // First statement in FOR loop .....some C code.... .....some C code.... - THREAD_EXIT; // last statement in FOR loop + THREAD_EXIT(); // last statement in FOR loop END_FOR; - THREAD_ENTER; // First statement after FOR loop + THREAD_ENTER(); // First statement after FOR loop ***************************************************************/ #include "firebird.h" @@ -599,12 +599,12 @@ ISC_STATUS GDS_DSQL_EXECUTE_CPP( open_cursor->opn_next = open_cursors; open_cursors = open_cursor; THD_MUTEX_UNLOCK(&cursors_mutex); - THREAD_EXIT; + THREAD_EXIT(); ISC_STATUS_ARRAY local_status; gds__transaction_cleanup(local_status, trans_handle, cleanup_transaction, NULL); - THREAD_ENTER; + THREAD_ENTER(); } if (!sing_status) { @@ -852,7 +852,7 @@ ISC_STATUS callback_execute_immediate( ISC_STATUS* status, } // 1. Locate why_db_handle, corresponding to jrd_database_handle - THREAD_EXIT; + THREAD_EXIT(); THD_MUTEX_LOCK (&databases_mutex); dsql_dbb* database; for (database = databases; database; database = database->dbb_next) @@ -867,7 +867,7 @@ ISC_STATUS callback_execute_immediate( ISC_STATUS* status, status[1] = isc_bad_db_handle; status[2] = isc_arg_end; THD_MUTEX_UNLOCK(&databases_mutex); - THREAD_ENTER; + THREAD_ENTER(); return status[1]; } WHY_DBB why_db_handle = WHY_translate_handle(database->dbb_database_handle); @@ -880,13 +880,13 @@ ISC_STATUS callback_execute_immediate( ISC_STATUS* status, status[1] = isc_virmemexh; status[2] = isc_arg_end; THD_MUTEX_UNLOCK(&databases_mutex); - THREAD_ENTER; + THREAD_ENTER(); return status[1]; } why_trans_handle->handle.h_tra = jrd_transaction_handle; why_trans_handle->parent = why_db_handle; THD_MUTEX_UNLOCK (&databases_mutex); - THREAD_ENTER; + THREAD_ENTER(); // 3. Call execute... function const ISC_STATUS rc = dsql8_execute_immediate_common(status, @@ -903,7 +903,7 @@ ISC_STATUS callback_execute_immediate( ISC_STATUS* status, WHY_DBB GetWhyAttachment (ISC_STATUS* status, Jrd::Attachment* jrd_attachment_handle) { - THREAD_EXIT; + THREAD_EXIT(); THD_MUTEX_LOCK (&databases_mutex); dsql_dbb* database; WHY_DBB db_handle; @@ -921,7 +921,7 @@ WHY_DBB GetWhyAttachment (ISC_STATUS* status, status[2] = isc_arg_end; } THD_MUTEX_UNLOCK (&databases_mutex); - THREAD_ENTER; + THREAD_ENTER(); return database ? db_handle : 0; } @@ -1078,11 +1078,11 @@ ISC_STATUS GDS_DSQL_FETCH_CPP( ISC_STATUS* user_status, MOVD_move(&desc, &offset_parameter->par_desc); - THREAD_EXIT; + THREAD_EXIT(); s = isc_receive2(tdsql->tsql_status, &request->req_handle, message->msg_number, message->msg_length, message->msg_buffer, 0, direction, offset); - THREAD_ENTER; + THREAD_ENTER(); if (s) { punt(); @@ -1109,11 +1109,11 @@ ISC_STATUS GDS_DSQL_FETCH_CPP( ISC_STATUS* user_status, USHORT* ret_length = (USHORT *) (dsql_msg_buf + (IPTR) null->par_user_desc.dsc_address); UCHAR* buffer = dsql_msg_buf + (IPTR) parameter->par_user_desc.dsc_address; - THREAD_EXIT; + THREAD_EXIT(); s = isc_get_segment(tdsql->tsql_status, &request->req_handle, ret_length, parameter->par_user_desc.dsc_length, reinterpret_cast(buffer)); - THREAD_ENTER; + THREAD_ENTER(); if (!s) { RESTORE_THREAD_DATA; return 0; @@ -1130,11 +1130,11 @@ ISC_STATUS GDS_DSQL_FETCH_CPP( ISC_STATUS* user_status, punt(); } - THREAD_EXIT; + THREAD_EXIT(); s = isc_receive(tdsql->tsql_status, &request->req_handle, message->msg_number, message->msg_length, message->msg_buffer, 0); - THREAD_ENTER; + THREAD_ENTER(); if (s) { punt(); @@ -1282,11 +1282,11 @@ ISC_STATUS GDS_DSQL_INSERT_CPP( ISC_STATUS* user_status, const SCHAR* buffer = reinterpret_cast( dsql_msg_buf + (IPTR) parameter->par_user_desc.dsc_address); - THREAD_EXIT; + THREAD_EXIT(); const ISC_STATUS s = isc_put_segment(tdsql->tsql_status, &request->req_handle, parameter->par_user_desc.dsc_length, buffer); - THREAD_ENTER; + THREAD_ENTER(); if (s) punt(); } @@ -2855,7 +2855,7 @@ static void cleanup_database(FB_API_HANDLE* db_handle, void* flag) return; /* if (flag) - THREAD_EXIT;*/ + THREAD_EXIT();*/ THD_MUTEX_LOCK(&databases_mutex); @@ -2873,13 +2873,13 @@ static void cleanup_database(FB_API_HANDLE* db_handle, void* flag) if (dbb->dbb_requests[i]) isc_release_request(user_status, reinterpret_cast (&dbb->dbb_requests[i])); - THREAD_ENTER; + THREAD_ENTER(); } HSHD_finish(dbb); delete dbb->dbb_pool; } else if (flag) - THREAD_ENTER; + THREAD_ENTER(); */ if (dbb) { HSHD_finish(dbb); @@ -2929,11 +2929,11 @@ static void cleanup_transaction (FB_API_HANDLE tra_handle, void* arg) * Over the long run, it might be better to move the subsystem_exit() * call in why.c below the cleanup handlers. smistry 9-27-98 */ - THREAD_ENTER; //ttt + THREAD_ENTER(); //ttt GDS_DSQL_FREE_CPP( local_status, &open_cursor->opn_request, DSQL_close); - THREAD_EXIT; + THREAD_EXIT(); THD_MUTEX_LOCK(&cursors_mutex); open_cursor_ptr = &open_cursors; } @@ -2960,13 +2960,13 @@ static void close_cursor( dsql_req* request) ISC_STATUS_ARRAY status_vector; if (request->req_handle) { - THREAD_EXIT; //ttt + THREAD_EXIT(); //ttt if (request->req_type == REQ_GET_SEGMENT || request->req_type == REQ_PUT_SEGMENT) isc_close_blob(status_vector, &request->req_handle); else isc_unwind_request(status_vector, &request->req_handle, 0); - THREAD_ENTER; + THREAD_ENTER(); } request->req_flags &= ~(REQ_cursor_open | REQ_embedded_sql_cursor); @@ -3118,13 +3118,13 @@ static void execute_blob( dsql_req* request, if (null && *((SSHORT *) null->par_desc.dsc_address) < 0) { memset(blob_id, 0, sizeof(ISC_QUAD)); } - THREAD_EXIT; + THREAD_EXIT(); s = isc_open_blob2(tdsql->tsql_status, &request->req_dbb->dbb_database_handle, &request->req_trans, &request->req_handle, blob_id, bpb_length, bpb); - THREAD_ENTER; + THREAD_ENTER(); if (s) { punt(); } @@ -3134,13 +3134,13 @@ static void execute_blob( dsql_req* request, request->req_handle = 0; ISC_QUAD* blob_id = (ISC_QUAD*) parameter->par_desc.dsc_address; memset(blob_id, 0, sizeof(ISC_QUAD)); - THREAD_EXIT; + THREAD_EXIT(); s = isc_create_blob2(tdsql->tsql_status, &request->req_dbb->dbb_database_handle, &request->req_trans, &request->req_handle, blob_id, bpb_length, reinterpret_cast(bpb)); - THREAD_ENTER; + THREAD_ENTER(); if (s) { punt(); } @@ -3196,43 +3196,43 @@ static ISC_STATUS execute_request(dsql_req* request, switch (request->req_type) { case REQ_START_TRANS: - THREAD_EXIT; + THREAD_EXIT(); s = isc_start_transaction( tdsql->tsql_status, &request->req_trans, 1, &request->req_dbb->dbb_database_handle, request->req_blr_data.getCount(), request->req_blr_data.begin()); - THREAD_ENTER; + THREAD_ENTER(); if (s) punt(); *trans_handle = request->req_trans; return FB_SUCCESS; case REQ_COMMIT: - THREAD_EXIT; + THREAD_EXIT(); s = isc_commit_transaction(tdsql->tsql_status, &request->req_trans); - THREAD_ENTER; + THREAD_ENTER(); if (s) punt(); *trans_handle = 0; return FB_SUCCESS; case REQ_COMMIT_RETAIN: - THREAD_EXIT; + THREAD_EXIT(); s = isc_commit_retaining(tdsql->tsql_status, &request->req_trans); - THREAD_ENTER; + THREAD_ENTER(); if (s) punt(); return FB_SUCCESS; case REQ_ROLLBACK: - THREAD_EXIT; + THREAD_EXIT(); s = isc_rollback_transaction(tdsql->tsql_status, &request->req_trans); - THREAD_ENTER; + THREAD_ENTER(); if (s) punt(); *trans_handle = 0; @@ -3289,7 +3289,7 @@ static ISC_STATUS execute_request(dsql_req* request, use_msg_length = 0; use_msg = NULL; } - THREAD_EXIT; + THREAD_EXIT(); s = isc_transact_request(tdsql->tsql_status, &request->req_dbb->dbb_database_handle, &request->req_trans, @@ -3299,7 +3299,7 @@ static ISC_STATUS execute_request(dsql_req* request, reinterpret_cast(in_msg), use_msg_length, reinterpret_cast(use_msg)); - THREAD_ENTER; + THREAD_ENTER(); if (s) punt(); @@ -3332,12 +3332,12 @@ static ISC_STATUS execute_request(dsql_req* request, message = (dsql_msg*) request->req_send; if (!message) { - THREAD_EXIT; + THREAD_EXIT(); s = isc_start_request(tdsql->tsql_status, &request->req_handle, &request->req_trans, 0); - THREAD_ENTER; + THREAD_ENTER(); if (s) punt(); } @@ -3350,7 +3350,7 @@ static ISC_STATUS execute_request(dsql_req* request, in_msg_length, in_msg); - THREAD_EXIT; + THREAD_EXIT(); s = isc_start_and_send(tdsql->tsql_status, &request->req_handle, &request->req_trans, @@ -3358,7 +3358,7 @@ static ISC_STATUS execute_request(dsql_req* request, message->msg_length, message->msg_buffer, 0); - THREAD_ENTER; + THREAD_ENTER(); if (s) { punt(); @@ -3389,14 +3389,14 @@ static ISC_STATUS execute_request(dsql_req* request, message->msg_buffer = (UCHAR*)FB_ALIGN((U_IPTR) temp_buffer, DOUBLE_ALIGN); } - THREAD_EXIT; + THREAD_EXIT(); s = isc_receive(tdsql->tsql_status, &request->req_handle, message->msg_number, message->msg_length, message->msg_buffer, 0); - THREAD_ENTER; + THREAD_ENTER(); if (s) { punt(); } @@ -3419,7 +3419,7 @@ static ISC_STATUS execute_request(dsql_req* request, (UCHAR*)gds__alloc((ULONG) message->msg_length); s = 0; - THREAD_EXIT; + THREAD_EXIT(); for (counter = 0; counter < 2 && !s; counter++) { s = isc_receive(local_status, @@ -3429,7 +3429,7 @@ static ISC_STATUS execute_request(dsql_req* request, message_buffer, 0); } - THREAD_ENTER; + THREAD_ENTER(); gds__free(message_buffer); /* two successful receives means more than one record @@ -3629,14 +3629,14 @@ static USHORT get_plan_info( // get the access path info for the underlying request from the engine - THREAD_EXIT; + THREAD_EXIT(); s = isc_request_info(tdsql->tsql_status, &request->req_handle, 0, sizeof(explain_info), explain_info, sizeof(explain_buffer), explain_buffer); - THREAD_ENTER; + THREAD_ENTER(); if (s) return 0; @@ -3649,13 +3649,13 @@ static USHORT get_plan_info( return 0; } - THREAD_EXIT; + THREAD_EXIT(); s = isc_request_info(tdsql->tsql_status, &request->req_handle, 0, sizeof(explain_info), explain_info, BUFFER_XLARGE, explain_ptr); - THREAD_ENTER; + THREAD_ENTER(); if (s) { // CVC: Before returning, deallocate the buffer! @@ -3742,14 +3742,14 @@ static USHORT get_request_info( // get the info for the request from the engine - THREAD_EXIT; + THREAD_EXIT(); s = isc_request_info(tdsql->tsql_status, &request->req_handle, 0, sizeof(record_info), record_info, buffer_length, buffer); - THREAD_ENTER; + THREAD_ENTER(); if (s) return 0; @@ -4144,9 +4144,9 @@ static dsql_dbb* init(FB_API_HANDLE* db_handle) } #endif - THREAD_EXIT; + THREAD_EXIT(); THD_MUTEX_LOCK(&databases_mutex); - THREAD_ENTER; + THREAD_ENTER(); if (!init_flag) { @@ -4189,22 +4189,22 @@ static dsql_dbb* init(FB_API_HANDLE* db_handle) ISC_STATUS_ARRAY user_status; - THREAD_EXIT; + THREAD_EXIT(); isc_database_cleanup(user_status, db_handle, cleanup_database, NULL); - THREAD_ENTER; + THREAD_ENTER(); // Determine if the database is V3 or V4 SCHAR buffer[128]; database->dbb_flags |= DBB_v3; - THREAD_EXIT; + THREAD_EXIT(); const ISC_STATUS s = isc_database_info(user_status, db_handle, sizeof(db_hdr_info_items), db_hdr_info_items, sizeof(buffer), buffer); - THREAD_ENTER; + THREAD_ENTER(); if (s) { return database; @@ -4801,12 +4801,12 @@ static dsql_req* prepare( sizeof(ISC_STATUS) * ISC_STATUS_LENGTH); } - THREAD_EXIT; + THREAD_EXIT(); const ISC_STATUS status = isc_compile_request(tdsql->tsql_status, &request->req_dbb->dbb_database_handle, &request->req_handle, length, (const char*)(request->req_blr_data.begin())); - THREAD_ENTER; + THREAD_ENTER(); // restore warnings (if there are any) if (local_status[2] == isc_arg_warning) @@ -4964,9 +4964,9 @@ static void release_request(dsql_req* request, bool top_level) // If a request has been compiled, release it now if (request->req_handle) { - THREAD_EXIT; + THREAD_EXIT(); isc_release_request(status_vector, &request->req_handle); - THREAD_ENTER; + THREAD_ENTER(); } // free blr memory diff --git a/src/dsql/metd.epp b/src/dsql/metd.epp index 0f109b7560..2aa7609c91 100644 --- a/src/dsql/metd.epp +++ b/src/dsql/metd.epp @@ -59,27 +59,27 @@ V4 Multi-threading changes. -- direct calls to gds__ () & isc_ () entrypoints - THREAD_EXIT; + THREAD_EXIT(); gds__ () or isc_ () call. - THREAD_ENTER; + THREAD_ENTER(); -- calls through embedded GDML. the following protocol will be used. Care should be taken if nested FOR loops are added. - THREAD_EXIT; // last statment before FOR loop + THREAD_EXIT(); // last statment before FOR loop FOR ............... - THREAD_ENTER; // First statment in FOR loop + THREAD_ENTER(); // First statment in FOR loop .....some C code.... .....some C code.... - THREAD_EXIT; // last statment in FOR loop + THREAD_EXIT(); // last statment in FOR loop END_FOR; - THREAD_ENTER; // First statment after FOR loop + THREAD_ENTER(); // First statment after FOR loop ***************************************************************/ DATABASE DB = STATIC "yachts.lnk"; @@ -107,9 +107,9 @@ static inline void metd_rec_lock() rec_mutex_inited = 1; THD_rec_mutex_init (&rec_mutex); } - THREAD_EXIT; + THREAD_EXIT(); THD_rec_mutex_lock (&rec_mutex); - THREAD_ENTER; + THREAD_ENTER(); } static inline void metd_rec_unlock() @@ -307,14 +307,14 @@ dsql_intlsym* METD_get_collation(dsql_req* request, const dsql_str* name) gds_trans = request->req_trans; iname = NULL; - THREAD_EXIT; + THREAD_EXIT(); FOR(REQUEST_HANDLE dbb->dbb_requests[irq_collation]) X IN RDB$COLLATIONS CROSS Y IN RDB$CHARACTER_SETS OVER RDB$CHARACTER_SET_ID WITH X.RDB$COLLATION_NAME EQ name->str_data; - THREAD_ENTER; + THREAD_ENTER(); iname = FB_NEW_RPT(*dbb->dbb_pool, name->str_length) dsql_intlsym; strcpy(iname->intlsym_name, (TEXT *) name->str_data); @@ -327,13 +327,13 @@ dsql_intlsym* METD_get_collation(dsql_req* request, const dsql_str* name) iname->intlsym_collate_id); iname->intlsym_bytes_per_char = (Y.RDB$BYTES_PER_CHARACTER.NULL) ? 1 : (Y.RDB$BYTES_PER_CHARACTER); - THREAD_EXIT; + THREAD_EXIT(); END_FOR ON_ERROR // Assume V3 database END_ERROR; - THREAD_ENTER; + THREAD_ENTER(); if (!iname) return NULL; @@ -393,7 +393,7 @@ USHORT METD_get_col_default(dsql_req* request, gds_trans = request->req_trans; // V4.x multi threading requirements - THREAD_EXIT; + THREAD_EXIT(); FOR(REQUEST_HANDLE dbb->dbb_requests[irq_col_default]) RFL IN RDB$RELATION_FIELDS CROSS @@ -402,7 +402,7 @@ USHORT METD_get_col_default(dsql_req* request, RFL.RDB$FIELD_SOURCE EQ FLD.RDB$FIELD_NAME AND RFL.RDB$FIELD_NAME EQ for_col_name - THREAD_ENTER; + THREAD_ENTER(); if (!RFL.RDB$DEFAULT_VALUE.NULL) { blob_id = &RFL.RDB$DEFAULT_VALUE; @@ -417,21 +417,21 @@ USHORT METD_get_col_default(dsql_req* request, if (*has_default) { // open the blob - THREAD_EXIT; + THREAD_EXIT(); stat = isc_open_blob2(status_vect, &DB, &gds_trans, &blob_handle, blob_id, sizeof(blr_bpb), blr_bpb); - THREAD_ENTER; + THREAD_ENTER(); if (stat) ERRD_punt(); // fetch segments. Assuming here that the buffer is big enough. ptr_in_buffer = buffer; while (true) { - THREAD_EXIT; + THREAD_EXIT(); stat = isc_get_segment(status_vect, &blob_handle, &length, buff_length, ptr_in_buffer); - THREAD_ENTER; + THREAD_ENTER(); ptr_in_buffer = ptr_in_buffer + length; buff_length = buff_length - length; result += length; @@ -447,9 +447,9 @@ USHORT METD_get_col_default(dsql_req* request, ERRD_punt(); } - THREAD_EXIT; + THREAD_EXIT(); isc_close_blob(status_vect, &blob_handle); - THREAD_ENTER; + THREAD_ENTER(); /* the default string must be of the form: blr_version4 blr_literal ..... blr_eoc */ @@ -466,10 +466,10 @@ USHORT METD_get_col_default(dsql_req* request, result = 2; } - THREAD_EXIT; + THREAD_EXIT(); END_FOR ON_ERROR ERRD_punt(); - END_ERROR THREAD_ENTER; + END_ERROR THREAD_ENTER(); return result; } @@ -508,7 +508,7 @@ dsql_intlsym* METD_get_charset(dsql_req* request, USHORT length, const char* nam gds_trans = request->req_trans; iname = NULL; - THREAD_EXIT; + THREAD_EXIT(); FOR(REQUEST_HANDLE dbb->dbb_requests[irq_charset]) X IN RDB$COLLATIONS @@ -519,7 +519,7 @@ dsql_intlsym* METD_get_charset(dsql_req* request, USHORT length, const char* nam AND Z.RDB$FIELD_NAME EQ "RDB$CHARACTER_SET_NAME" AND Y.RDB$DEFAULT_COLLATE_NAME EQ X.RDB$COLLATION_NAME; - THREAD_ENTER; + THREAD_ENTER(); iname = FB_NEW_RPT(*dbb->dbb_pool, length) dsql_intlsym; strcpy(iname->intlsym_name, (char*) name); @@ -533,14 +533,14 @@ dsql_intlsym* METD_get_charset(dsql_req* request, USHORT length, const char* nam iname->intlsym_bytes_per_char = (Y.RDB$BYTES_PER_CHARACTER.NULL) ? 1 : (Y.RDB$BYTES_PER_CHARACTER); - THREAD_EXIT; + THREAD_EXIT(); END_FOR ON_ERROR // Assume V3 database END_ERROR; - THREAD_ENTER; + THREAD_ENTER(); if (!iname) return NULL; @@ -586,32 +586,32 @@ USHORT METD_get_charset_bpc (dsql_req* request, handle = 0; - THREAD_EXIT; + THREAD_EXIT(); FOR (REQUEST_HANDLE handle) Y IN RDB$CHARACTER_SETS WITH Y.RDB$CHARACTER_SET_ID EQ charset_id - THREAD_ENTER; + THREAD_ENTER(); bpc = (Y.RDB$BYTES_PER_CHARACTER.NULL) ? 1 : (Y.RDB$BYTES_PER_CHARACTER); - THREAD_EXIT; + THREAD_EXIT(); END_FOR ON_ERROR // Assume V3 database END_ERROR; /************* - THREAD_ENTER; + THREAD_ENTER(); Un comment these if any code is added after the END_ERROR and gds__release request () - THREAD_EXIT; + THREAD_EXIT(); *************/ isc_release_request (gds_status, &handle); - THREAD_ENTER; + THREAD_ENTER(); return bpc; } @@ -646,13 +646,13 @@ dsql_str* METD_get_default_charset(dsql_req* request) handle = 0; - THREAD_EXIT; + THREAD_EXIT(); FOR(REQUEST_HANDLE handle) FIRST 1 DBB IN RDB$DATABASE WITH DBB.RDB$CHARACTER_SET_NAME NOT MISSING; - THREAD_ENTER; + THREAD_ENTER(); // Terminate ASCIIZ string on first trailing blank fb_utils::fb_exact_name(DBB.RDB$CHARACTER_SET_NAME); @@ -665,23 +665,23 @@ dsql_str* METD_get_default_charset(dsql_req* request) *p++ = *str_charset++; } - THREAD_EXIT; + THREAD_EXIT(); END_FOR ON_ERROR // Assume V3 database END_ERROR; /************* -THREAD_ENTER; +THREAD_ENTER(); Un comment these if any code is added after the END_ERROR and gds__release request () -THREAD_EXIT; +THREAD_EXIT(); *************/ isc_release_request(gds_status, &handle); - THREAD_ENTER; + THREAD_ENTER(); if (dbb->dbb_dfl_charset == NULL) dbb->dbb_flags |= DBB_no_charset; @@ -709,12 +709,12 @@ USHORT METD_get_domain(dsql_req* request, dsql_fld* field, const char* name) // DB = dbb->dbb_database_handle; gds_trans = request->req_trans; - THREAD_EXIT; + THREAD_EXIT(); FOR(REQUEST_HANDLE dbb->dbb_requests[irq_domain]) FLX IN RDB$FIELDS WITH FLX.RDB$FIELD_NAME EQ name - THREAD_ENTER; + THREAD_ENTER(); found = true; field->fld_length = FLX.RDB$FIELD_LENGTH; @@ -740,13 +740,13 @@ USHORT METD_get_domain(dsql_req* request, dsql_fld* field, const char* name) // field->fld_seg_length = FLX.RDB$SEGMENT_LENGTH; } - THREAD_EXIT; + THREAD_EXIT(); END_FOR ON_ERROR END_ERROR; - THREAD_ENTER; + THREAD_ENTER(); return found ? TRUE : FALSE; } @@ -777,12 +777,12 @@ USHORT METD_get_domain_default(dsql_req* request, USHORT result = 0; // V4.x multi threading requirements - THREAD_EXIT; + THREAD_EXIT(); FOR(REQUEST_HANDLE dbb->dbb_requests[irq_domain_2]) FLD IN RDB$FIELDS WITH FLD.RDB$FIELD_NAME EQ domain_name - THREAD_ENTER; + THREAD_ENTER(); ISC_QUAD* blob_id; if (!FLD.RDB$DEFAULT_VALUE.NULL) { @@ -794,24 +794,24 @@ USHORT METD_get_domain_default(dsql_req* request, if (*has_default) { // open the blob - THREAD_EXIT; + THREAD_EXIT(); isc_blob_handle blob_handle = 0; ISC_STATUS stat = isc_open_blob2(status_vect, &DB, &gds_trans, &blob_handle, blob_id, sizeof(blr_bpb), blr_bpb); - THREAD_ENTER; + THREAD_ENTER(); if (stat) ERRD_punt(); // fetch segments. Assume buffer is big enough. TEXT* ptr_in_buffer = buffer; while (true) { - THREAD_EXIT; + THREAD_EXIT(); USHORT length; stat = isc_get_segment(status_vect, &blob_handle, &length, buff_length, ptr_in_buffer); - THREAD_ENTER; + THREAD_ENTER(); ptr_in_buffer = ptr_in_buffer + length; buff_length = buff_length - length; result += length; @@ -827,9 +827,9 @@ USHORT METD_get_domain_default(dsql_req* request, ERRD_punt(); } - THREAD_EXIT; + THREAD_EXIT(); isc_close_blob(status_vect, &blob_handle); - THREAD_ENTER; + THREAD_ENTER(); /* the default string must be of the form: blr_version4 blr_literal ..... blr_eoc */ @@ -846,14 +846,14 @@ USHORT METD_get_domain_default(dsql_req* request, result = 2; } - THREAD_EXIT; + THREAD_EXIT(); END_FOR ON_ERROR ERRD_punt(); END_ERROR - THREAD_ENTER; + THREAD_ENTER(); return result; } @@ -910,13 +910,13 @@ dsql_udf* METD_get_function(dsql_req* request, const dsql_str* name) DsqlNodStack stack; USHORT return_arg; - THREAD_EXIT; + THREAD_EXIT(); FOR(REQUEST_HANDLE dbb->dbb_requests[irq_function]) X IN RDB$FUNCTIONS WITH X.RDB$FUNCTION_NAME EQ name->str_data - THREAD_ENTER; + THREAD_ENTER(); userFunc = FB_NEW_RPT(*dbb->dbb_pool, name->str_length) dsql_udf; /* Moved below as still can't say for sure it will be stored. @@ -929,13 +929,13 @@ dsql_udf* METD_get_function(dsql_req* request, const dsql_str* name) return_arg = X.RDB$RETURN_ARGUMENT; userFunc->udf_arguments = 0; - THREAD_EXIT; + THREAD_EXIT(); END_FOR ON_ERROR END_ERROR; - THREAD_ENTER; + THREAD_ENTER(); if (!userFunc) { metd_rec_unlock(); @@ -948,7 +948,7 @@ dsql_udf* METD_get_function(dsql_req* request, const dsql_str* name) * the one that is appropriate for the database we are * working against. */ - THREAD_EXIT; + THREAD_EXIT(); if (dbb->dbb_flags & DBB_v3) { FOR(REQUEST_HANDLE dbb->dbb_requests[irq_func_return]) @@ -956,7 +956,7 @@ dsql_udf* METD_get_function(dsql_req* request, const dsql_str* name) X.RDB$FUNCTION_NAME EQ name->str_data AND X.RDB$ARGUMENT_POSITION EQ return_arg - THREAD_ENTER; + THREAD_ENTER(); userFunc->udf_dtype = (X.RDB$FIELD_TYPE != blr_blob) ? gds_cvt_blr_dtype[X.RDB$FIELD_TYPE] : dtype_blob; @@ -964,7 +964,7 @@ dsql_udf* METD_get_function(dsql_req* request, const dsql_str* name) userFunc->udf_sub_type = X.RDB$FIELD_SUB_TYPE; userFunc->udf_length = X.RDB$FIELD_LENGTH; - THREAD_EXIT; + THREAD_EXIT(); END_FOR ON_ERROR @@ -977,7 +977,7 @@ dsql_udf* METD_get_function(dsql_req* request, const dsql_str* name) X.RDB$FUNCTION_NAME EQ name->str_data SORTED BY X.RDB$ARGUMENT_POSITION - THREAD_ENTER; + THREAD_ENTER(); if (X.RDB$ARGUMENT_POSITION == return_arg) { userFunc->udf_dtype = (X.RDB$FIELD_TYPE != blr_blob) ? @@ -1039,14 +1039,14 @@ dsql_udf* METD_get_function(dsql_req* request, const dsql_str* name) stack.push(udf_param_node); } - THREAD_EXIT; + THREAD_EXIT(); END_FOR ON_ERROR END_ERROR; } - THREAD_ENTER; + THREAD_ENTER(); /* Adjust the return type & length of the UDF to account for * cstring & varying. While a UDF can return CSTRING, we convert it @@ -1144,7 +1144,7 @@ dsql_nod* METD_get_primary_key(dsql_req* request, const dsql_str* relation_name) dsql_nod* list = NULL; USHORT count = 0; - THREAD_EXIT; + THREAD_EXIT(); FOR(REQUEST_HANDLE dbb->dbb_requests[irq_primary_key]) X IN RDB$INDICES CROSS @@ -1156,7 +1156,7 @@ dsql_nod* METD_get_primary_key(dsql_req* request, const dsql_str* relation_name) AND Z.RDB$CONSTRAINT_TYPE EQ "PRIMARY KEY" SORTED BY Y.RDB$FIELD_POSITION - THREAD_ENTER; + THREAD_ENTER(); if (!list) list = MAKE_node(nod_list, (int) X.RDB$SEGMENT_COUNT); @@ -1166,13 +1166,13 @@ dsql_nod* METD_get_primary_key(dsql_req* request, const dsql_str* relation_name) list->nod_arg[count] = field_node; count++; - THREAD_EXIT; + THREAD_EXIT(); END_FOR ON_ERROR END_ERROR; - THREAD_ENTER; + THREAD_ENTER(); return list; } @@ -1230,13 +1230,13 @@ dsql_prc* METD_get_procedure(dsql_req* request, const dsql_str* name) gds_trans = request->req_trans; procedure = NULL; - THREAD_EXIT; + THREAD_EXIT(); FOR(REQUEST_HANDLE dbb->dbb_requests[irq_procedure]) X IN RDB$PROCEDURES WITH X.RDB$PROCEDURE_NAME EQ name->str_data - THREAD_ENTER; + THREAD_ENTER(); fb_utils::fb_exact_name(X.RDB$OWNER_NAME); @@ -1249,13 +1249,13 @@ dsql_prc* METD_get_procedure(dsql_req* request, const dsql_str* name) strcpy(procedure->prc_name, (TEXT *) name->str_data); strcpy(procedure->prc_owner, (TEXT *) X.RDB$OWNER_NAME); - THREAD_EXIT; + THREAD_EXIT(); END_FOR ON_ERROR END_ERROR; - THREAD_ENTER; + THREAD_ENTER(); if (!procedure) { metd_rec_unlock(); @@ -1271,7 +1271,7 @@ dsql_prc* METD_get_procedure(dsql_req* request, const dsql_str* name) ptr = &procedure->prc_inputs; count = defaults = 0; - THREAD_EXIT; + THREAD_EXIT(); FOR(REQUEST_HANDLE dbb->dbb_requests[irq_parameters]) PR IN RDB$PROCEDURE_PARAMETERS CROSS @@ -1281,7 +1281,7 @@ dsql_prc* METD_get_procedure(dsql_req* request, const dsql_str* name) AND PR.RDB$PARAMETER_TYPE = type SORTED BY DESCENDING PR.RDB$PARAMETER_NUMBER - THREAD_ENTER; + THREAD_ENTER(); count++; // allocate the field block @@ -1321,13 +1321,13 @@ dsql_prc* METD_get_procedure(dsql_req* request, const dsql_str* name) defaults++; } - THREAD_EXIT; + THREAD_EXIT(); END_FOR ON_ERROR END_ERROR; - THREAD_ENTER; + THREAD_ENTER(); if (type) procedure->prc_out_count = count; @@ -1430,7 +1430,7 @@ dsql_rel* METD_get_relation(dsql_req* request, const dsql_str* name) gds_trans = request->req_trans; relation = NULL; - THREAD_EXIT; + THREAD_EXIT(); FOR(REQUEST_HANDLE dbb->dbb_requests[irq_relation]) X IN RDB$RELATIONS WITH X.RDB$RELATION_NAME EQ name->str_data @@ -1438,7 +1438,7 @@ dsql_rel* METD_get_relation(dsql_req* request, const dsql_str* name) been assigned, and this is a type of request which does not use ids, prepare a temporary relation block to provide information without caching it */ - THREAD_ENTER; + THREAD_ENTER(); fb_utils::fb_exact_name(X.RDB$OWNER_NAME); @@ -1472,13 +1472,13 @@ dsql_rel* METD_get_relation(dsql_req* request, const dsql_str* name) } } - THREAD_EXIT; + THREAD_EXIT(); END_FOR ON_ERROR END_ERROR; - THREAD_ENTER; + THREAD_ENTER(); if (!relation) { metd_rec_unlock(); @@ -1489,7 +1489,7 @@ dsql_rel* METD_get_relation(dsql_req* request, const dsql_str* name) ptr = &relation->rel_fields; - THREAD_EXIT; + THREAD_EXIT(); if (dbb->dbb_flags & DBB_v3) { FOR(REQUEST_HANDLE dbb->dbb_requests[irq_fields]) @@ -1499,7 +1499,7 @@ dsql_rel* METD_get_relation(dsql_req* request, const dsql_str* name) AND RFR.RDB$RELATION_NAME EQ name->str_data SORTED BY RFR.RDB$FIELD_POSITION - THREAD_ENTER; + THREAD_ENTER(); // allocate the field block @@ -1538,7 +1538,7 @@ dsql_rel* METD_get_relation(dsql_req* request, const dsql_str* name) field->fld_flags |= FLD_nullable; - THREAD_EXIT; + THREAD_EXIT(); END_FOR ON_ERROR @@ -1553,7 +1553,7 @@ dsql_rel* METD_get_relation(dsql_req* request, const dsql_str* name) AND RFR.RDB$RELATION_NAME EQ name->str_data SORTED BY RFR.RDB$FIELD_POSITION - THREAD_ENTER; + THREAD_ENTER(); // allocate the field block @@ -1609,14 +1609,14 @@ dsql_rel* METD_get_relation(dsql_req* request, const dsql_str* name) field->fld_flags |= FLD_nullable; } - THREAD_EXIT; + THREAD_EXIT(); END_FOR ON_ERROR END_ERROR; } - THREAD_ENTER; + THREAD_ENTER(); /* Since we could give up control due to the THREAD_EXIT and THEAD_ENTER, * another thread may have added the same table in the mean time @@ -1676,25 +1676,25 @@ dsql_str* METD_get_trigger_relation(dsql_req* request, const dsql_str* name, USH relation = NULL; - THREAD_EXIT; + THREAD_EXIT(); FOR(REQUEST_HANDLE dbb->dbb_requests[irq_trigger]) X IN RDB$TRIGGERS WITH X.RDB$TRIGGER_NAME EQ name->str_data - THREAD_ENTER; + THREAD_ENTER(); fb_utils::fb_exact_name(X.RDB$RELATION_NAME); relation = MAKE_string(X.RDB$RELATION_NAME, strlen(X.RDB$RELATION_NAME)); *trig_type = X.RDB$TRIGGER_TYPE; - THREAD_EXIT; + THREAD_EXIT(); END_FOR ON_ERROR END_ERROR; - THREAD_ENTER; + THREAD_ENTER(); return relation; } @@ -1721,24 +1721,24 @@ USHORT METD_get_type(dsql_req* request, const dsql_str* name, char* field, SSHOR found = FALSE; - THREAD_EXIT; + THREAD_EXIT(); FOR(REQUEST_HANDLE dbb->dbb_requests[irq_type]) X IN RDB$TYPES WITH X.RDB$FIELD_NAME EQ field AND X.RDB$TYPE_NAME EQ name->str_data; - THREAD_ENTER; + THREAD_ENTER(); found = TRUE; *value = X.RDB$TYPE; - THREAD_EXIT; + THREAD_EXIT(); END_FOR ON_ERROR END_ERROR; - THREAD_ENTER; + THREAD_ENTER(); return found; } @@ -1768,12 +1768,12 @@ dsql_rel* METD_get_view_relation(dsql_req* request, DB = dbb->dbb_database_handle; gds_trans = request->req_trans; - THREAD_EXIT; + THREAD_EXIT(); FOR(REQUEST_HANDLE dbb->dbb_requests[irq_view], LEVEL level) X IN RDB$VIEW_RELATIONS WITH X.RDB$VIEW_NAME EQ view_name - THREAD_ENTER; + THREAD_ENTER(); fb_utils::fb_exact_name(X.RDB$CONTEXT_NAME); fb_utils::fb_exact_name(X.RDB$RELATION_NAME); @@ -1795,13 +1795,13 @@ dsql_rel* METD_get_view_relation(dsql_req* request, return relation; } - THREAD_EXIT; + THREAD_EXIT(); END_FOR ON_ERROR END_ERROR; - THREAD_ENTER; + THREAD_ENTER(); return NULL; } @@ -1827,12 +1827,12 @@ static void check_array( dsql_req* request, const TEXT* field_name, dsql_fld* fi DB = dbb->dbb_database_handle; gds_trans = request->req_trans; - THREAD_EXIT; + THREAD_EXIT(); FOR(REQUEST_HANDLE dbb->dbb_requests[irq_dimensions]) X IN RDB$FIELDS WITH X.RDB$FIELD_NAME EQ field_name - THREAD_ENTER; + THREAD_ENTER(); if (!X.RDB$DIMENSIONS.NULL && X.RDB$DIMENSIONS) { field->fld_element_dtype = field->fld_dtype; @@ -1842,14 +1842,14 @@ static void check_array( dsql_req* request, const TEXT* field_name, dsql_fld* fi field->fld_dimensions = X.RDB$DIMENSIONS; } - THREAD_EXIT; + THREAD_EXIT(); END_FOR ON_ERROR dbb->dbb_flags |= DBB_no_arrays; END_ERROR; - THREAD_ENTER; + THREAD_ENTER(); } diff --git a/src/ipserver/ipclient.cpp b/src/ipserver/ipclient.cpp index 63a6eccabf..cba84180d6 100644 --- a/src/ipserver/ipclient.cpp +++ b/src/ipserver/ipclient.cpp @@ -4379,10 +4379,10 @@ static bool send_and_wait( ICC icc) // next, wait for the server to signal us back or die - THREAD_EXIT; + THREAD_EXIT(); result = WaitForMultipleObjects((DWORD) 2, icc->icc_waits, FALSE, INFINITE); - THREAD_ENTER; + THREAD_ENTER(); if (result != WAIT_OBJECT_0) { icc->icc_flags |= ICCF_UNMAP_CLIENT; diff --git a/src/jrd/cch.cpp b/src/jrd/cch.cpp index 8222fd312b..e29cb85e16 100644 --- a/src/jrd/cch.cpp +++ b/src/jrd/cch.cpp @@ -659,9 +659,9 @@ const int CCH_EXCLUSIVE_RETRY_INTERVAL =1; /* retry interval in seconds */ if (remaining > CCH_EXCLUSIVE_RETRY_INTERVAL) { - THREAD_EXIT; + THREAD_EXIT(); THREAD_SLEEP(CCH_EXCLUSIVE_RETRY_INTERVAL * 1000); - THREAD_ENTER; + THREAD_ENTER(); } #ifdef CANCEL_OPERATION @@ -991,7 +991,7 @@ void CCH_fetch_page( AST_CHECK; ++dbb->dbb_reads; #ifdef SUPERSERVER - THREAD_EXIT; + THREAD_EXIT(); #endif page = bdb->bdb_buffer; jrd_file* file = dbb->dbb_file; @@ -1050,7 +1050,7 @@ void CCH_fetch_page( break; } #ifdef SUPERSERVER - THREAD_ENTER; + THREAD_ENTER(); #endif if (!CCH_rollover_to_shadow(dbb, file, false)) { PAGE_LOCK_RELEASE(bdb->bdb_lock); @@ -1070,7 +1070,7 @@ void CCH_fetch_page( } } #ifdef SUPERSERVER - THREAD_EXIT; + THREAD_EXIT(); #endif } } @@ -1100,7 +1100,7 @@ void CCH_fetch_page( break; } #ifdef SUPERSERVER - THREAD_ENTER; + THREAD_ENTER(); #endif if (!CCH_rollover_to_shadow(dbb, file, false)) { PAGE_LOCK_RELEASE(bdb->bdb_lock); @@ -1120,7 +1120,7 @@ void CCH_fetch_page( } } #ifdef SUPERSERVER - THREAD_EXIT; + THREAD_EXIT(); #endif } } @@ -1135,7 +1135,7 @@ void CCH_fetch_page( && !(dbb->dbb_flags & DBB_damaged))) { #ifdef SUPERSERVER - THREAD_ENTER; + THREAD_ENTER(); #endif IBERR_build_status(tdbb->tdbb_status_vector, isc_db_corrupt, @@ -1151,7 +1151,7 @@ void CCH_fetch_page( #endif /* NO_CHECKSUM */ #ifdef SUPERSERVER - THREAD_ENTER; + THREAD_ENTER(); #endif AST_CHECK; @@ -1217,9 +1217,9 @@ void CCH_fini(thread_db* tdbb) bcb->bcb_flags &= ~BCB_cache_reader; ISC_event_post(event); SLONG count = ISC_event_clear(event); - THREAD_EXIT; + THREAD_EXIT(); ISC_event_wait(1, &event, &count, 0, NULL, 0); - THREAD_ENTER; + THREAD_ENTER(); /* Now dispose off the cache reader associated semaphore */ ISC_event_fini(event); } @@ -1237,9 +1237,9 @@ void CCH_fini(thread_db* tdbb) bcb->bcb_flags &= ~BCB_cache_writer; ISC_event_post(dbb->dbb_writer_event); /* Wake up running thread */ - THREAD_EXIT; + THREAD_EXIT(); ISC_event_wait(1, &event, &count, 0, NULL, 0); - THREAD_ENTER; + THREAD_ENTER(); /* Cleanup initialization event */ ISC_event_fini(event); } @@ -1713,9 +1713,9 @@ void CCH_init(thread_db* tdbb, ULONG number) ERR_bugcheck_msg("cannot start thread"); } - THREAD_EXIT; + THREAD_EXIT(); ISC_event_wait(1, &event, &count, 5 * 1000000, NULL, 0); - THREAD_ENTER; + THREAD_ENTER(); #endif #ifdef CACHE_WRITER @@ -1731,9 +1731,9 @@ void CCH_init(thread_db* tdbb, ULONG number) { ERR_bugcheck_msg("cannot start thread"); } - THREAD_EXIT; + THREAD_EXIT(); ISC_event_wait(1, &event, &count, 5 * 1000000, NULL, 0); - THREAD_ENTER; + THREAD_ENTER(); /* Clean up initialization event */ ISC_event_fini(event); } @@ -3067,7 +3067,7 @@ static void THREAD_ROUTINE cache_reader(Database* dbb) * busy at a time. * **************************************/ - THREAD_ENTER; + THREAD_ENTER(); /* Establish a thread context. */ /* Note: Since this function operates as its own thread, @@ -3105,7 +3105,7 @@ static void THREAD_ROUTINE cache_reader(Database* dbb) catch (const std::exception& ex) { Firebird::stuff_exception(status_vector, ex); gds__log_status(dbb->dbb_file->fil_string, status_vector); - THREAD_EXIT; + THREAD_EXIT(); return; } @@ -3127,9 +3127,9 @@ static void THREAD_ROUTINE cache_reader(Database* dbb) prf* next_prefetch = &prefetch1; if (dbb->dbb_flags & DBB_suspend_bgio) { - THREAD_EXIT; + THREAD_EXIT(); ISC_event_wait(1, &reader_event, &count, 10 * 1000000, NULL, 0); - THREAD_ENTER; + THREAD_ENTER(); continue; } @@ -3197,9 +3197,9 @@ static void THREAD_ROUTINE cache_reader(Database* dbb) } else { bcb->bcb_flags &= ~BCB_reader_active; - THREAD_EXIT; + THREAD_EXIT(); ISC_event_wait(1, &reader_event, &count, 10 * 1000000, NULL, 0); - THREAD_ENTER; + THREAD_ENTER(); } bcb = dbb->dbb_bcb; } @@ -3208,7 +3208,7 @@ static void THREAD_ROUTINE cache_reader(Database* dbb) delete tdbb->tdbb_attachment; bcb->bcb_flags &= ~BCB_cache_reader; ISC_event_post(reader_event); - THREAD_EXIT; + THREAD_EXIT(); } // try catch (const std::exception& ex) { @@ -3236,7 +3236,7 @@ static void THREAD_ROUTINE cache_writer(Database* dbb) * deems it necessary. * **************************************/ - THREAD_ENTER; + THREAD_ENTER(); /* Establish a thread context. */ /* Note: Since this function operates as its own thread, @@ -3276,7 +3276,7 @@ static void THREAD_ROUTINE cache_writer(Database* dbb) Firebird::stuff_exception(status_vector, ex); gds__log_status(dbb->dbb_file->fil_string, status_vector); ISC_event_fini(writer_event); - THREAD_EXIT; + THREAD_EXIT(); return; } @@ -3288,9 +3288,9 @@ static void THREAD_ROUTINE cache_writer(Database* dbb) SLONG starting_page = -1; if (dbb->dbb_flags & DBB_suspend_bgio) { - THREAD_EXIT; + THREAD_EXIT(); ISC_event_wait(1, &writer_event, &count, 10 * 1000000, NULL, 0); - THREAD_ENTER; + THREAD_ENTER(); continue; } @@ -3305,9 +3305,9 @@ static void THREAD_ROUTINE cache_writer(Database* dbb) } #endif - THREAD_EXIT; - THREAD_YIELD; - THREAD_ENTER; + THREAD_EXIT(); + THREAD_YIELD(); + THREAD_ENTER(); if (bcb->bcb_flags & BCB_free_pending) { BufferDesc* bdb = get_buffer(tdbb, FREE_PAGE, LATCH_none, 1); @@ -3357,9 +3357,9 @@ static void THREAD_ROUTINE cache_writer(Database* dbb) #endif else { bcb->bcb_flags &= ~BCB_writer_active; - THREAD_EXIT; + THREAD_EXIT(); ISC_event_wait(1, &writer_event, &count, 10 * 1000000, NULL, 0); - THREAD_ENTER; + THREAD_ENTER(); } bcb = dbb->dbb_bcb; } @@ -3370,7 +3370,7 @@ static void THREAD_ROUTINE cache_writer(Database* dbb) /* Notify the finalization caller that we're finishing. */ ISC_event_post(dbb->dbb_writer_event_fini); ISC_event_fini(writer_event); - THREAD_EXIT; + THREAD_EXIT(); } // try catch (const std::exception& ex) { @@ -3946,7 +3946,7 @@ static BufferDesc* get_buffer(thread_db* tdbb, SLONG page, LATCH latch, SSHORT l /* This code is only used by the background I/O threads: cache writer, cache reader and garbage collector. */ - THREAD_EXIT; + THREAD_EXIT(); for (que_inst = bcb->bcb_in_use.que_backward; que_inst != &bcb->bcb_in_use; que_inst = que_inst->que_backward) @@ -3959,7 +3959,7 @@ static BufferDesc* get_buffer(thread_db* tdbb, SLONG page, LATCH latch, SSHORT l continue; } if (bdb->bdb_flags & BDB_db_dirty) { - THREAD_ENTER; + THREAD_ENTER(); // BCB_MUTEX_RELEASE; return bdb; } @@ -3971,14 +3971,14 @@ static BufferDesc* get_buffer(thread_db* tdbb, SLONG page, LATCH latch, SSHORT l else { /* if (page == CHECKPOINT_PAGE) */ if (bdb->bdb_flags & BDB_checkpoint) { - THREAD_ENTER; + THREAD_ENTER(); // BCB_MUTEX_RELEASE; return bdb; } } } - THREAD_ENTER; + THREAD_ENTER(); // BCB_MUTEX_RELEASE; return NULL; } @@ -4390,7 +4390,7 @@ static SSHORT latch_bdb( count = ISC_event_clear(event)) { // LATCH_MUTEX_RELEASE; - THREAD_EXIT; + THREAD_EXIT(); if (latch_wait == 1) { timeout_occurred = ISC_event_wait(1, &event, &count, 120 * 1000000, NULL, event); @@ -4400,7 +4400,7 @@ static SSHORT latch_bdb( ISC_event_wait(1, &event, &count, -latch_wait * 1000000, NULL, event); } - THREAD_ENTER; + THREAD_ENTER(); // LATCH_MUTEX_ACQUIRE; } @@ -4810,10 +4810,10 @@ static void prefetch_epilogue(Prefetch* prefetch, ISC_STATUS* status_vector) return; } - THREAD_EXIT; + THREAD_EXIT(); prefetch->prf_piob.piob_wait = TRUE; const bool async_status = PIO_status(&prefetch->prf_piob, status_vector); - THREAD_ENTER; + THREAD_ENTER(); /* If there was an I/O error release all buffer latches acquired for the prefetch request. */ @@ -4909,12 +4909,12 @@ static void prefetch_io(Prefetch* prefetch, ISC_STATUS* status_vector) ISC_event_post(dbb->dbb_reader_event); } - THREAD_EXIT; + THREAD_EXIT(); const bool async_status = PIO_read_ahead(dbb, prefetch->prf_start_page, prefetch->prf_io_buffer, prefetch->prf_page_count, &prefetch->prf_piob, status_vector); - THREAD_ENTER; + THREAD_ENTER(); if (!async_status) { BufferDesc** next_bdb = prefetch->prf_bdbs; for (USHORT i = 0; i < prefetch->prf_max_prefetch; i++) { @@ -5576,12 +5576,12 @@ static bool write_page( else { // We need to write our pages to main database files #ifdef SUPERSERVER - THREAD_EXIT; + THREAD_EXIT(); #endif jrd_file* file = dbb->dbb_file; while (!PIO_write(file, bdb, page, status)) { #ifdef SUPERSERVER - THREAD_ENTER; + THREAD_ENTER(); #endif if (!CCH_rollover_to_shadow(dbb, file, inAst)) { bdb->bdb_flags |= BDB_io_error; @@ -5589,13 +5589,13 @@ static bool write_page( return false; } #ifdef SUPERSERVER - THREAD_EXIT; + THREAD_EXIT(); #endif file = dbb->dbb_file; } #ifdef SUPERSERVER - THREAD_ENTER; + THREAD_ENTER(); #endif if (bdb->bdb_page == HEADER_PAGE) { dbb->dbb_last_header_write = diff --git a/src/jrd/dfw.epp b/src/jrd/dfw.epp index ed977fd7eb..edf952f9db 100644 --- a/src/jrd/dfw.epp +++ b/src/jrd/dfw.epp @@ -2712,9 +2712,9 @@ static bool delete_relation(thread_db* tdbb, SSHORT phase, DeferredWork* work, break; } - THREAD_EXIT; + THREAD_EXIT(); THREAD_SLEEP(1 * 1000); - THREAD_ENTER; + THREAD_ENTER(); } if (relation->rel_sweep_count) @@ -3837,13 +3837,13 @@ static bool modify_procedure( thread_db* tdbb, THD_rec_mutex_init(&tdbb->tdbb_database->dbb_sp_rec_mutex); tdbb->tdbb_database->dbb_flags |= DBB_sp_rec_mutex_init; } - THREAD_EXIT; + THREAD_EXIT(); if (THD_rec_mutex_lock(&tdbb->tdbb_database->dbb_sp_rec_mutex)) { - THREAD_ENTER; + THREAD_ENTER(); return false; } - THREAD_ENTER; + THREAD_ENTER(); #endif /* SUPERSERVER */ // Do not allow to modify procedure used by user requests if (procedure->prc_use_count && MET_procedure_in_use(tdbb,procedure)) diff --git a/src/jrd/dyn.epp b/src/jrd/dyn.epp index 30d89c9d5f..032038cb61 100644 --- a/src/jrd/dyn.epp +++ b/src/jrd/dyn.epp @@ -132,9 +132,9 @@ void DYN_ddl(Attachment* attachment, jrd_tra* transaction, USHORT length, try { #if defined(SUPERSERVER) && defined(WIN_NT) - THREAD_EXIT; + THREAD_EXIT(); THD_MUTEX_LOCK(dbb->dbb_mutexes + DBB_MUTX_dyn); - THREAD_ENTER; + THREAD_ENTER(); #else #ifdef V4_THREADING V4_JRD_MUTEX_LOCK(dbb->dbb_mutexes + DBB_MUTX_dyn); diff --git a/src/jrd/event.cpp b/src/jrd/event.cpp index 016a575414..7cd0707cc0 100644 --- a/src/jrd/event.cpp +++ b/src/jrd/event.cpp @@ -642,9 +642,9 @@ static FRB alloc_global(UCHAR type, ULONG length, bool recurse) while (true) { release(); - THREAD_EXIT; + THREAD_EXIT(); Sleep(3); - THREAD_ENTER; + THREAD_ENTER(); acquire(); process = (PRB) SRQ_ABS_PTR(EVENT_process_offset); @@ -904,14 +904,14 @@ static void delete_session(SLONG session_id) */ while (session->ses_flags & SES_delivering && (++kill_anyway != 40)) { release(); - THREAD_EXIT; + THREAD_EXIT(); #ifdef WIN_NT Sleep(250); #endif #if (defined SOLARIS_MT || defined LINUX) sleep(1); #endif - THREAD_ENTER; + THREAD_ENTER(); acquire(); session = (SES) SRQ_ABS_PTR(session_id); } diff --git a/src/jrd/execute_statement.cpp b/src/jrd/execute_statement.cpp index e1ed081384..dbfeda2985 100644 --- a/src/jrd/execute_statement.cpp +++ b/src/jrd/execute_statement.cpp @@ -123,7 +123,7 @@ void ExecuteStatement::Open(thread_db* tdbb, jrd_nod* sql, SSHORT nVars, bool Si Sqlda->version = 1; tdbb->tdbb_transaction->tra_callback_count++; - THREAD_EXIT; + THREAD_EXIT(); // For normal diagnostic const int max_diag_len = 50; @@ -165,7 +165,7 @@ void ExecuteStatement::Open(thread_db* tdbb, jrd_nod* sql, SSHORT nVars, bool Si # undef Chk err_handler: - THREAD_ENTER; + THREAD_ENTER(); tdbb->tdbb_transaction->tra_callback_count--; if (status[0] == 1 && status[1]) { memcpy(tdbb->tdbb_status_vector, status, sizeof(local)); @@ -186,17 +186,17 @@ bool ExecuteStatement::Fetch(thread_db* tdbb, jrd_nod** JrdVar) memset(local, 0, sizeof(local)); status = local; tdbb->tdbb_transaction->tra_callback_count++; - THREAD_EXIT; + THREAD_EXIT(); if (isc_dsql_fetch(status, &Statement, SQLDA_VERSION1, Sqlda) == 100) { isc_dsql_free_statement(status, &Statement, DSQL_drop); - THREAD_ENTER; + THREAD_ENTER(); tdbb->tdbb_transaction->tra_callback_count--; Statement = 0; return false; } - THREAD_ENTER; + THREAD_ENTER(); tdbb->tdbb_transaction->tra_callback_count--; if (status[0] == 1 && status[1]) { memcpy(tdbb->tdbb_status_vector, status, sizeof(local)); @@ -260,17 +260,17 @@ rec_err: if (SingleMode) { tdbb->tdbb_transaction->tra_callback_count++; - THREAD_EXIT; + THREAD_EXIT(); if (isc_dsql_fetch(status, &Statement, SQLDA_VERSION1, Sqlda) == 100) { isc_dsql_free_statement(status, &Statement, DSQL_drop); - THREAD_ENTER; + THREAD_ENTER(); tdbb->tdbb_transaction->tra_callback_count--; Statement = 0; return false; } - THREAD_ENTER; + THREAD_ENTER(); tdbb->tdbb_transaction->tra_callback_count--; if (! (status[0] == 1 && status[1])) { status[0] = isc_arg_gds; @@ -287,10 +287,10 @@ void ExecuteStatement::Close(thread_db* tdbb) { if (Statement) { tdbb->tdbb_transaction->tra_callback_count++; - THREAD_EXIT; + THREAD_EXIT(); // for a while don't check for errors while freeing statement isc_dsql_free_statement(0, &Statement, DSQL_drop); - THREAD_ENTER; + THREAD_ENTER(); tdbb->tdbb_transaction->tra_callback_count--; Statement = 0; } diff --git a/src/jrd/fun.epp b/src/jrd/fun.epp index 1dce658e5a..39777da9a4 100644 --- a/src/jrd/fun.epp +++ b/src/jrd/fun.epp @@ -30,7 +30,7 @@ * 2003.08.10 Claudio Valderrama: Fix SF Bugs #544132 and #728839. */ /* -$Id: fun.epp,v 1.53 2004-05-12 19:37:17 brodsom Exp $ +$Id: fun.epp,v 1.54 2004-05-15 00:55:08 brodsom Exp $ */ #include "firebird.h" @@ -795,9 +795,9 @@ static SLONG blob_lseek( blb* blob, USHORT mode, SLONG offset) * **************************************/ /* add thread enter and thread_exit wrappers */ - THREAD_ENTER; + THREAD_ENTER(); const SLONG return_offset = BLB_lseek(blob, mode, offset); - THREAD_EXIT; + THREAD_EXIT(); return (return_offset); } @@ -817,10 +817,10 @@ static void blob_put_segment( blb* blob, const UCHAR* buffer, USHORT length) /* As this is a call-back from a UDF, must reacquire the engine mutex */ - THREAD_ENTER; + THREAD_ENTER(); thread_db* tdbb = GET_THREAD_DATA; BLB_put_segment(tdbb, blob, buffer, length); - THREAD_EXIT; + THREAD_EXIT(); } @@ -844,10 +844,10 @@ static SSHORT blob_get_segment( * **************************************/ /* add thread enter and thread_exit wrappers */ - THREAD_ENTER; + THREAD_ENTER(); thread_db* tdbb = GET_THREAD_DATA; *return_length = BLB_get_segment(tdbb, blob, buffer, length); - THREAD_EXIT; + THREAD_EXIT(); if (blob->blb_flags & BLB_eof) return 0; @@ -956,9 +956,9 @@ static void invoke(UserFunction* function, START_CHECK_FOR_EXCEPTIONS(function->fun_exception_message.c_str()); if (function->fun_return_arg) { - THREAD_EXIT; + THREAD_EXIT(); CALL_UDF(function->fun_entrypoint, void); - THREAD_ENTER; + THREAD_ENTER(); } else if ((SLONG) return_ptr->fun_mechanism == FUN_value) { @@ -967,10 +967,10 @@ static void invoke(UserFunction* function, case dtype_sql_time: case dtype_sql_date: case dtype_long: - THREAD_EXIT; + THREAD_EXIT(); value->vlu_misc.vlu_long = CALL_UDF(function->fun_entrypoint, SLONG); - THREAD_ENTER; + THREAD_ENTER(); break; case dtype_short: @@ -978,10 +978,10 @@ static void invoke(UserFunction* function, // must always be returned as a LONG. See v3.2 release notes // 1994-September-28 David Schnepper - THREAD_EXIT; + THREAD_EXIT(); value->vlu_misc.vlu_short = (SSHORT) CALL_UDF(function->fun_entrypoint, SLONG); - THREAD_ENTER; + THREAD_ENTER(); break; case dtype_real: @@ -989,27 +989,27 @@ static void invoke(UserFunction* function, // must always be returned as a DOUBLE. See v3.2 release notes // 1994-September-28 David Schnepper - THREAD_EXIT; + THREAD_EXIT(); value->vlu_misc.vlu_float = (float) CALL_UDF(function->fun_entrypoint, double); - THREAD_ENTER; + THREAD_ENTER(); break; case dtype_int64: - THREAD_EXIT; + THREAD_EXIT(); value->vlu_misc.vlu_int64 = CALL_UDF(function->fun_entrypoint, SINT64); - THREAD_ENTER; + THREAD_ENTER(); break; case dtype_double: #ifdef VMS case dtype_d_float: #endif - THREAD_EXIT; + THREAD_EXIT(); value->vlu_misc.vlu_double = CALL_UDF(function->fun_entrypoint, double); - THREAD_ENTER; + THREAD_ENTER(); break; case dtype_timestamp: @@ -1020,10 +1020,10 @@ static void invoke(UserFunction* function, } else { - THREAD_EXIT; + THREAD_EXIT(); typedef UCHAR* pUCHAR; temp_ptr = CALL_UDF(function->fun_entrypoint, pUCHAR); - THREAD_ENTER; + THREAD_ENTER(); if (temp_ptr != NULL) { diff --git a/src/jrd/isc_sync.cpp b/src/jrd/isc_sync.cpp index c21ca81284..d3912cfd88 100644 --- a/src/jrd/isc_sync.cpp +++ b/src/jrd/isc_sync.cpp @@ -1426,7 +1426,7 @@ void ISC_exception_post(ULONG sig_num, const TEXT* err_msg) * **************************************/ if (!SCH_thread_enter_check()) - THREAD_ENTER; + THREAD_ENTER(); // If there's no err_msg, we asumed the switch() finds no case or we crash. // Too much goodwill put on the caller. Weak programming style. @@ -1510,7 +1510,7 @@ ULONG ISC_exception_post(ULONG except_code, const TEXT* err_msg) if (!SCH_thread_enter_check ()) { - THREAD_ENTER; + THREAD_ENTER(); } thread_db* tdbb = GET_THREAD_DATA; diff --git a/src/jrd/jrd.cpp b/src/jrd/jrd.cpp index 8ad5616bd2..ba6241e289 100644 --- a/src/jrd/jrd.cpp +++ b/src/jrd/jrd.cpp @@ -164,14 +164,14 @@ const SSHORT WAIT_PERIOD = -1; # undef V4_JRD_MUTEX_LOCK # undef V4_JRD_MUTEX_UNLOCK # define V4_INIT THD_INIT -# define V4_GLOBAL_MUTEX_LOCK {THREAD_EXIT; THD_GLOBAL_MUTEX_LOCK; THREAD_ENTER;} +# define V4_GLOBAL_MUTEX_LOCK {THREAD_EXIT(); THD_GLOBAL_MUTEX_LOCK; THREAD_ENTER();} # define V4_GLOBAL_MUTEX_UNLOCK THD_GLOBAL_MUTEX_UNLOCK # define V4_MUTEX_INIT(mutx) THD_MUTEX_INIT (mutx) -# define V4_MUTEX_LOCK(mutx) {THREAD_EXIT; THD_MUTEX_LOCK (mutx); THREAD_ENTER;} +# define V4_MUTEX_LOCK(mutx) {THREAD_EXIT(); THD_MUTEX_LOCK (mutx); THREAD_ENTER();} # define V4_MUTEX_UNLOCK(mutx) THD_MUTEX_UNLOCK (mutx) # define V4_MUTEX_DESTROY(mutx) THD_MUTEX_DESTROY (mutx) # ifndef SUPERSERVER -# define V4_JRD_MUTEX_LOCK(mutx) {THREAD_EXIT; THD_JRD_MUTEX_LOCK (mutx); THREAD_ENTER;} +# define V4_JRD_MUTEX_LOCK(mutx) {THREAD_EXIT(); THD_JRD_MUTEX_LOCK (mutx); THREAD_ENTER();} # define V4_JRD_MUTEX_UNLOCK(mutx) THD_JRD_MUTEX_UNLOCK (mutx) # endif /* SUPERSERVER */ # endif /* V4_THREADING */ @@ -199,9 +199,9 @@ static REC_MUTX_T databases_rec_mutex; #define JRD_SS_INIT_MUTEX THD_rec_mutex_init (&databases_rec_mutex) #define JRD_SS_DESTROY_MUTEX THD_rec_mutex_destroy (&databases_rec_mutex) -#define JRD_SS_MUTEX_LOCK {THREAD_EXIT;\ +#define JRD_SS_MUTEX_LOCK {THREAD_EXIT();\ THD_rec_mutex_lock (&databases_rec_mutex);\ - THREAD_ENTER;} + THREAD_ENTER();} #define JRD_SS_MUTEX_UNLOCK THD_rec_mutex_unlock (&databases_rec_mutex) #define JRD_SS_THD_MUTEX_LOCK THD_rec_mutex_lock (&databases_rec_mutex) #define JRD_SS_THD_MUTEX_UNLOCK THD_rec_mutex_unlock (&databases_rec_mutex) @@ -4279,9 +4279,9 @@ bool JRD_reschedule(thread_db* tdbb, SLONG quantum, bool punt) if (!(tdbb->tdbb_flags & TDBB_sweeper)) SCH_schedule(); else { - THREAD_EXIT; - THREAD_YIELD; - THREAD_ENTER; + THREAD_EXIT(); + THREAD_YIELD(); + THREAD_ENTER(); } /* If database has been shutdown then get out */ @@ -5406,9 +5406,9 @@ static Database* init(thread_db* tdbb, if (!initialized) { THD_INIT; - THREAD_EXIT; + THREAD_EXIT(); THD_GLOBAL_MUTEX_LOCK; - THREAD_ENTER; + THREAD_ENTER(); PluginManager::load_engine_plugins(); if (!initialized) { #if defined(V4_THREADING) && !defined(SUPERSERVER) @@ -6024,7 +6024,7 @@ TEXT* JRD_num_attachments(TEXT* const buf, USHORT buf_len, USHORT flag, } #endif - THREAD_ENTER; + THREAD_ENTER(); /* Zip through the list of databases and count the number of local * connections. If buf is not NULL then copy all the database names @@ -6110,7 +6110,7 @@ TEXT* JRD_num_attachments(TEXT* const buf, USHORT buf_len, USHORT flag, } } - THREAD_EXIT; + THREAD_EXIT(); *atts = num_att; *dbs = num_dbs; diff --git a/src/jrd/met.epp b/src/jrd/met.epp index 652df4bdde..ac23c39415 100644 --- a/src/jrd/met.epp +++ b/src/jrd/met.epp @@ -37,7 +37,7 @@ * 2004.01.16 Vlad Horsun: added support for default parameters */ /* -$Id: met.epp,v 1.118 2004-05-14 18:43:33 brodsom Exp $ +$Id: met.epp,v 1.119 2004-05-15 00:55:08 brodsom Exp $ */ // This MUST be at the top of the file #ifdef DARWIN @@ -2556,15 +2556,15 @@ jrd_prc* MET_procedure(thread_db* tdbb, int id, bool noscan, USHORT flags) THD_rec_mutex_init(&dbb->dbb_sp_rec_mutex); dbb->dbb_flags |= DBB_sp_rec_mutex_init; } - THREAD_EXIT; + THREAD_EXIT(); if (THD_rec_mutex_lock(&dbb->dbb_sp_rec_mutex)) { - THREAD_ENTER; + THREAD_ENTER(); return NULL; } - THREAD_ENTER; + THREAD_ENTER(); #endif /* SUPERSERVER */ @@ -3234,12 +3234,12 @@ void MET_scan_relation( thread_db* tdbb, jrd_rel* relation) THD_rec_mutex_init(&dbb->dbb_sp_rec_mutex); dbb->dbb_flags |= DBB_sp_rec_mutex_init; } - THREAD_EXIT; + THREAD_EXIT(); if (THD_rec_mutex_lock(&dbb->dbb_sp_rec_mutex)) { - THREAD_ENTER; + THREAD_ENTER(); return; } - THREAD_ENTER; + THREAD_ENTER(); #endif /* SUPERSERVER */ if (relation->rel_flags & REL_scanned diff --git a/src/jrd/nbak.cpp b/src/jrd/nbak.cpp index fb26128662..90e54a5735 100644 --- a/src/jrd/nbak.cpp +++ b/src/jrd/nbak.cpp @@ -32,7 +32,7 @@ * Contributor(s): * * - * $Id: nbak.cpp,v 1.31 2004-05-12 19:37:23 brodsom Exp $ + * $Id: nbak.cpp,v 1.32 2004-05-15 00:55:09 brodsom Exp $ * */ @@ -137,10 +137,10 @@ void BackupManager::lock_state_write(bool thread_exit) { #ifdef SUPERSERVER if (thread_exit) - THREAD_EXIT; + THREAD_EXIT(); state_lock->beginWrite(); if (thread_exit) - THREAD_ENTER; + THREAD_ENTER(); #else fb_assert(!(flags & NBAK_state_in_use)); thread_db* tdbb = GET_THREAD_DATA; @@ -225,10 +225,10 @@ bool BackupManager::lock_alloc_write(bool thread_exit) throw() { #ifdef SUPERSERVER if (thread_exit) - THREAD_EXIT; + THREAD_EXIT(); alloc_lock->beginWrite(); if (thread_exit) - THREAD_ENTER; + THREAD_ENTER(); #else fb_assert(!(flags & NBAK_alloc_in_use)); thread_db* tdbb = GET_THREAD_DATA; @@ -284,10 +284,10 @@ bool BackupManager::lock_state(bool thread_exit) throw() return true; #ifdef SUPERSERVER if (thread_exit) - THREAD_EXIT; + THREAD_EXIT(); state_lock->beginRead(); if (thread_exit) - THREAD_ENTER; + THREAD_ENTER(); #else fb_assert(!(flags & NBAK_state_in_use)); flags |= NBAK_state_in_use; @@ -328,10 +328,10 @@ void BackupManager::unlock_state() throw() bool BackupManager::lock_alloc(bool thread_exit) throw() { #ifdef SUPERSERVER if (thread_exit) - THREAD_EXIT; + THREAD_EXIT(); alloc_lock->beginRead(); if (thread_exit) - THREAD_ENTER; + THREAD_ENTER(); #else fb_assert(!(flags & NBAK_alloc_in_use)); thread_db* tdbb = GET_THREAD_DATA; diff --git a/src/jrd/os/win32/ibinitdll.cpp b/src/jrd/os/win32/ibinitdll.cpp index 017aa903b7..c40afe30fd 100644 --- a/src/jrd/os/win32/ibinitdll.cpp +++ b/src/jrd/os/win32/ibinitdll.cpp @@ -52,7 +52,7 @@ BOOL WINAPI DllMain(HINSTANCE h, DWORD reason, LPVOID reserved) case DLL_PROCESS_DETACH: #ifdef EMBEDDED - THREAD_ENTER; + THREAD_ENTER(); JRD_shutdown_all(); #endif break; diff --git a/src/jrd/os/win32/thd_priority.cpp b/src/jrd/os/win32/thd_priority.cpp index 9a0a1064e7..099333de17 100644 --- a/src/jrd/os/win32/thd_priority.cpp +++ b/src/jrd/os/win32/thd_priority.cpp @@ -22,6 +22,11 @@ */ #include "firebird.h" +#include "../jrd/common.h" +#include "../jrd/thd.h" +#ifdef WIN_NT +#include // HANDLE +#endif #include "../jrd/os/thd_priority.h" #include "../common/config/config.h" @@ -33,8 +38,6 @@ #include #include -#include "../jrd/common.h" -#include "../jrd/thd_proto.h" #include #include diff --git a/src/jrd/pwd.cpp b/src/jrd/pwd.cpp index 390f5c5ab6..4929a7807c 100644 --- a/src/jrd/pwd.cpp +++ b/src/jrd/pwd.cpp @@ -118,9 +118,9 @@ void SecurityDatabase::fini() #ifndef EMBEDDED if (counter == 1 && lookup_db) { - THREAD_EXIT; + THREAD_EXIT(); isc_detach_database(status, &lookup_db); - THREAD_ENTER; + THREAD_ENTER(); } #endif } @@ -155,7 +155,7 @@ bool SecurityDatabase::lookup_user(TEXT * user_name, int *uid, int *gid, TEXT * { isc_detach_database(status, &lookup_db); } - THREAD_ENTER; + THREAD_ENTER(); ERR_post(isc_psw_attach, 0); } @@ -165,7 +165,7 @@ bool SecurityDatabase::lookup_user(TEXT * user_name, int *uid, int *gid, TEXT * if (isc_start_transaction(status, &lookup_trans, 1, &lookup_db, sizeof(TPB), TPB)) { - THREAD_ENTER; + THREAD_ENTER(); ERR_post(isc_psw_start_trans, 0); } @@ -192,7 +192,7 @@ bool SecurityDatabase::lookup_user(TEXT * user_name, int *uid, int *gid, TEXT * { isc_detach_database(status, &lookup_db); } - THREAD_ENTER; + THREAD_ENTER(); return found; } @@ -206,11 +206,11 @@ bool SecurityDatabase::prepare() if (lookup_db) { - THREAD_EXIT; + THREAD_EXIT(); return true; } - THREAD_EXIT; + THREAD_EXIT(); lookup_db = lookup_req = 0; @@ -318,9 +318,9 @@ void SecurityDatabase::verifyUser(TEXT* name, // found there. This means that another database must be accessed, and // that means the current context must be saved and restored. - THREAD_EXIT; + THREAD_EXIT(); instance.mutex.aquire(); - THREAD_ENTER; + THREAD_ENTER(); TEXT pw1[33]; const bool found = instance.lookup_user(name, uid, gid, pw1); instance.mutex.release(); diff --git a/src/jrd/qatest.cpp b/src/jrd/qatest.cpp index bf7883ee93..bec83a2b2e 100644 --- a/src/jrd/qatest.cpp +++ b/src/jrd/qatest.cpp @@ -222,10 +222,10 @@ int QATEST_entrypoint(ULONG * function, void *arg1, void *arg2, void *arg3) default: sprintf(filename, "Unknown QATEST_entrypoint #%lu", /* TXNN */ *function); - THREAD_ENTER; + THREAD_ENTER(); ERR_post(isc_random, isc_arg_string, ERR_cstring(filename), 0); - THREAD_EXIT; + THREAD_EXIT(); return 0; } } diff --git a/src/jrd/shut.cpp b/src/jrd/shut.cpp index 0c2efdee42..a47f17b44b 100644 --- a/src/jrd/shut.cpp +++ b/src/jrd/shut.cpp @@ -494,9 +494,9 @@ static bool shutdown_locks(Database* dbb, SSHORT flag) if (dbb->dbb_use_count) { /* Let active database threads rundown */ - THREAD_EXIT; + THREAD_EXIT(); THREAD_SLEEP(1 * 1000); - THREAD_ENTER; + THREAD_ENTER(); return false; } diff --git a/src/jrd/sort.cpp b/src/jrd/sort.cpp index 5560e308bc..abe7ddeb41 100644 --- a/src/jrd/sort.cpp +++ b/src/jrd/sort.cpp @@ -19,7 +19,7 @@ * * All Rights Reserved. * Contributor(s): ______________________________________. - * $Id: sort.cpp,v 1.66 2004-05-07 07:57:20 brodsom Exp $ + * $Id: sort.cpp,v 1.67 2004-05-15 00:55:09 brodsom Exp $ * * 2001-09-24 SJL - Temporary fix for large sort file bug * @@ -910,7 +910,7 @@ ULONG SORT_read_block( // Checkout of engine on sort I/O - THREAD_EXIT; + THREAD_EXIT(); // The following is a crock induced by a VMS C bug @@ -918,19 +918,19 @@ ULONG SORT_read_block( const ULONG len = length; for (i = 0; i < IO_RETRY; i++) { if (lseek(sfb->sfb_file, LSEEK_OFFSET_CAST seek, SEEK_SET) == -1) { - THREAD_ENTER; + THREAD_ENTER(); SORT_error(status_vector, sfb, "lseek", isc_io_read_err, errno); } if ((read_len = read(sfb->sfb_file, address, len)) == len) break; else if ((SSHORT) read_len == -1 && !SYSCALL_INTERRUPTED(errno)) { - THREAD_ENTER; + THREAD_ENTER(); SORT_error(status_vector, sfb, "read", isc_io_read_err, errno); } } if (i == IO_RETRY) { - THREAD_ENTER; + THREAD_ENTER(); SORT_error(status_vector, sfb, "read", isc_io_read_err, errno); } length -= read_len; @@ -938,7 +938,7 @@ ULONG SORT_read_block( seek += read_len; } - THREAD_ENTER; + THREAD_ENTER(); #ifdef DEBUG_SORT_TRACE write_trace("Read", sfb, org_seek, org_address, org_length); @@ -1199,7 +1199,7 @@ ULONG SORT_write_block(ISC_STATUS* status_vector, // Check out of engine on sort I/O - THREAD_EXIT; + THREAD_EXIT(); // The following is a crock induced by a VMS C bug @@ -1207,7 +1207,7 @@ ULONG SORT_write_block(ISC_STATUS* status_vector, ULONG len = length; for (i = 0; i < IO_RETRY; i++) { if (lseek(sfb->sfb_file, LSEEK_OFFSET_CAST seek, SEEK_SET) == -1) { - THREAD_ENTER; + THREAD_ENTER(); SORT_error(status_vector, sfb, "lseek", isc_io_write_err, errno); } @@ -1221,7 +1221,7 @@ ULONG SORT_write_block(ISC_STATUS* status_vector, write_len = write(sfb->sfb_file, address + write_len, len - write_len); if ((SSHORT) write_len == -1 && !SYSCALL_INTERRUPTED(errno)) { - THREAD_ENTER; + THREAD_ENTER(); SORT_error(status_vector, sfb, "write", isc_io_write_err, errno); } @@ -1229,7 +1229,7 @@ ULONG SORT_write_block(ISC_STATUS* status_vector, } if (i == IO_RETRY) { - THREAD_ENTER; + THREAD_ENTER(); SORT_error(status_vector, sfb, "write", isc_io_write_err, errno); } length -= write_len; @@ -1237,7 +1237,7 @@ ULONG SORT_write_block(ISC_STATUS* status_vector, seek += write_len; } - THREAD_ENTER; + THREAD_ENTER(); return seek; } @@ -2643,7 +2643,7 @@ static ULONG order(sort_context* scb) // Check out the engine - THREAD_EXIT; + THREAD_EXIT(); // Length of the key part of the record const SSHORT length = scb->scb_longs - SIZEOF_SR_BCKPTR_IN_LONGS; @@ -2712,7 +2712,7 @@ static ULONG order(sort_context* scb) // Check back into the engine - THREAD_ENTER; + THREAD_ENTER(); // It's OK to free this after checking back into the engine, there's // only fatal failures possible there @@ -2804,7 +2804,7 @@ static void sort(sort_context* scb) // Check out the engine - THREAD_EXIT; + THREAD_EXIT(); // First, insert a pointer to the high key @@ -2846,7 +2846,7 @@ static void sort(sort_context* scb) if (!scb->scb_dup_callback) { // Check back into the engine - THREAD_ENTER; + THREAD_ENTER(); return; } @@ -2897,7 +2897,7 @@ static void sort(sort_context* scb) // Check back into the engine - THREAD_ENTER; + THREAD_ENTER(); } #ifdef NOT_USED_OR_REPLACED diff --git a/src/jrd/svc.cpp b/src/jrd/svc.cpp index 3a5bf925ab..48d7dbeec7 100644 --- a/src/jrd/svc.cpp +++ b/src/jrd/svc.cpp @@ -139,7 +139,7 @@ using namespace Jrd; static inline void is_service_running(const Service* service) { if (!(service->svc_flags & SVC_forked)) { - THREAD_ENTER; + THREAD_ENTER(); ERR_post (isc_svcnoexe, isc_arg_string, service->svc_service->serv_name, 0); } @@ -161,7 +161,7 @@ bool ck_space_for_numeric(char*& info, const char* const end) { if (info < end) *info++ = isc_info_truncated; - THREAD_ENTER; + THREAD_ENTER(); return false; } return true; @@ -681,7 +681,7 @@ static int shutdown_thread(void *arg) { * **************************************/ - THREAD_ENTER; + THREAD_ENTER(); JRD_shutdown_all(); *reinterpret_cast(arg) = 1; return 0; @@ -708,7 +708,7 @@ void SVC_detach(Service* service) int flShutdownComplete = 0; gds__thread_start(shutdown_thread, &flShutdownComplete, THREAD_medium, 0, 0); - THREAD_EXIT; + THREAD_EXIT(); int timeout = 10; // seconds while (timeout--) { if (flShutdownComplete) @@ -879,7 +879,7 @@ ISC_STATUS SVC_query2(Service* service, ISC_STATUS *status; USHORT timeout; - THREAD_EXIT; + THREAD_EXIT(); /* Setup the status vector */ status = tdbb->tdbb_status_vector; @@ -1003,7 +1003,7 @@ ISC_STATUS SVC_query2(Service* service, (info = INF_put_item(isc_spb_dbname, length, ptr2, info, end))) { - THREAD_ENTER; + THREAD_ENTER(); return 0; } ptr2 += length; @@ -1066,7 +1066,7 @@ ISC_STATUS SVC_query2(Service* service, */ info = INF_put_item(item, strlen(buffer), buffer, info, end); if (!info) { - THREAD_ENTER; + THREAD_ENTER(); return 0; } break; @@ -1094,9 +1094,9 @@ ISC_STATUS SVC_query2(Service* service, case isc_info_svc_default_config: *info++ = item; if (service->svc_user_flag & SVC_user_dba) { - THREAD_ENTER; + THREAD_ENTER(); // TODO: reset the config values to defaults - THREAD_EXIT; + THREAD_EXIT(); } else need_admin_privs(&status, "isc_info_svc_default_config"); @@ -1105,9 +1105,9 @@ ISC_STATUS SVC_query2(Service* service, case isc_info_svc_set_config: *info++ = item; if (service->svc_user_flag & SVC_user_dba) { - THREAD_ENTER; + THREAD_ENTER(); // TODO: set the config values - THREAD_EXIT; + THREAD_EXIT(); } else { need_admin_privs(&status, "isc_info_svc_set_config"); @@ -1146,7 +1146,7 @@ ISC_STATUS SVC_query2(Service* service, /* The version of the server engine */ info = INF_put_item(item, strlen(GDS_VERSION), GDS_VERSION, info, end); if (!info) { - THREAD_ENTER; + THREAD_ENTER(); return 0; } break; @@ -1157,7 +1157,7 @@ ISC_STATUS SVC_query2(Service* service, 0, 0, NULL); info = INF_put_item(item, strlen(buffer), buffer, info, end); if (!info) { - THREAD_ENTER; + THREAD_ENTER(); return 0; } @@ -1170,7 +1170,7 @@ ISC_STATUS SVC_query2(Service* service, if (!(info = INF_put_item(item, strlen(buffer), buffer, info, end))) { - THREAD_ENTER; + THREAD_ENTER(); return 0; } break; @@ -1194,7 +1194,7 @@ ISC_STATUS SVC_query2(Service* service, *info++ = isc_info_truncated; l -= length; if (l > service->svc_resp_buf_len) { - THREAD_ENTER; + THREAD_ENTER(); if (service->svc_resp_buf) gds__free((SLONG *) service->svc_resp_buf); service->svc_resp_buf = (UCHAR *) gds__alloc((SLONG) l); @@ -1205,7 +1205,7 @@ ISC_STATUS SVC_query2(Service* service, l = 0; /* set the length to zero */ } service->svc_resp_buf_len = l; - THREAD_EXIT; + THREAD_EXIT(); } service_get(service, reinterpret_cast < char *>(service->svc_resp_buf), @@ -1225,7 +1225,7 @@ ISC_STATUS SVC_query2(Service* service, (service->svc_resp_ptr), info, end))) { - THREAD_ENTER; + THREAD_ENTER(); return 0; } service->svc_resp_ptr += length; @@ -1243,7 +1243,7 @@ ISC_STATUS SVC_query2(Service* service, UCHAR*>(buffer), 2); service_get(service, buffer, l, GET_BINARY, 0, &length); if (!(info = INF_put_item(item, length, buffer, info, end))) { - THREAD_ENTER; + THREAD_ENTER(); return 0; } break; @@ -1273,7 +1273,7 @@ ISC_STATUS SVC_query2(Service* service, with an indication that more is available. */ if (!(info = INF_put_item(item, length, info + 3, info, end))) { - THREAD_ENTER; + THREAD_ENTER(); return 0; } @@ -1312,7 +1312,7 @@ ISC_STATUS SVC_query2(Service* service, SVC_finish(service, SVC_finished); } - THREAD_ENTER; + THREAD_ENTER(); return tdbb->tdbb_status_vector[1]; } @@ -1340,7 +1340,7 @@ void SVC_query(Service* service, USHORT l, length, version, get_flags; USHORT timeout; - THREAD_EXIT; + THREAD_EXIT(); /* Process the send portion of the query first. */ @@ -1412,7 +1412,7 @@ void SVC_query(Service* service, info, end); if (!info) { - THREAD_ENTER; + THREAD_ENTER(); return; } length = INF_convert(num_dbs, buffer); @@ -1422,7 +1422,7 @@ void SVC_query(Service* service, info, end); if (!info) { - THREAD_ENTER; + THREAD_ENTER(); return; } } @@ -1476,7 +1476,7 @@ void SVC_query(Service* service, */ if (!(info = INF_put_item(item, strlen(PathBuffer), PathBuffer, info, end))) { - THREAD_ENTER; + THREAD_ENTER(); return; } break; @@ -1504,9 +1504,9 @@ void SVC_query(Service* service, case isc_info_svc_default_config: *info++ = item; if (service->svc_user_flag & SVC_user_dba) { - THREAD_ENTER; + THREAD_ENTER(); // TODO: reset the config values to defaults - THREAD_EXIT; + THREAD_EXIT(); } else need_admin_privs(&status, "isc_info_svc_default_config"); @@ -1515,9 +1515,9 @@ void SVC_query(Service* service, case isc_info_svc_set_config: *info++ = item; if (service->svc_user_flag & SVC_user_dba) { - THREAD_ENTER; + THREAD_ENTER(); // TODO: set the config values - THREAD_EXIT; + THREAD_EXIT(); } else { need_admin_privs(&status, "isc_info_svc_set_config"); @@ -1533,7 +1533,7 @@ void SVC_query(Service* service, (info = INF_put_item(item, length, buffer, info, end))) { - THREAD_ENTER; + THREAD_ENTER(); return; } break; @@ -1547,7 +1547,7 @@ void SVC_query(Service* service, (info = INF_put_item(item, length, buffer, info, end))) { - THREAD_ENTER; + THREAD_ENTER(); return; } break; @@ -1563,7 +1563,7 @@ void SVC_query(Service* service, *p = *gvp; if (!(info = INF_put_item(item, p - buffer, buffer, info, end))) { - THREAD_ENTER; + THREAD_ENTER(); return; } break; @@ -1577,7 +1577,7 @@ void SVC_query(Service* service, *p++ = IMPLEMENTATION; if (!(info = INF_put_item(item, p - buffer, buffer, info, end))) { - THREAD_ENTER; + THREAD_ENTER(); return; } break; @@ -1589,7 +1589,7 @@ void SVC_query(Service* service, if (!(info = INF_put_item(item, strlen(buffer), buffer, info, end))) { - THREAD_ENTER; + THREAD_ENTER(); return; } break; @@ -1614,7 +1614,7 @@ void SVC_query(Service* service, l -= length; if (l > service->svc_resp_buf_len) { - THREAD_ENTER; + THREAD_ENTER(); if (service->svc_resp_buf) gds__free((SLONG *) service->svc_resp_buf); service->svc_resp_buf = (UCHAR *) gds__alloc((SLONG) l); @@ -1626,7 +1626,7 @@ void SVC_query(Service* service, l = 0; /* set the length to zero */ } service->svc_resp_buf_len = l; - THREAD_EXIT; + THREAD_EXIT(); } service_get(service, reinterpret_cast(service->svc_resp_buf), @@ -1649,7 +1649,7 @@ void SVC_query(Service* service, info, end))) { - THREAD_ENTER; + THREAD_ENTER(); return; } service->svc_resp_ptr += length; @@ -1666,7 +1666,7 @@ void SVC_query(Service* service, service_get(service, buffer, l, GET_BINARY, 0, &length); if (!(info = INF_put_item(item, length, buffer, info, end))) { - THREAD_ENTER; + THREAD_ENTER(); return; } break; @@ -1714,7 +1714,7 @@ void SVC_query(Service* service, SVC_finish(service, SVC_finished); } - THREAD_ENTER; + THREAD_ENTER(); } @@ -1993,7 +1993,7 @@ void* SVC_start(Service* service, USHORT spb_length, const SCHAR* spb) event_t* evnt_ptr = reinterpret_cast (&(service->svc_start_event)); - THREAD_EXIT; + THREAD_EXIT(); /* create an event for the service. The event will be signaled once the * particular service has reached a point in which it can start to return * information to the client. This will allow isc_service_start to @@ -2022,7 +2022,7 @@ void* SVC_start(Service* service, USHORT spb_length, const SCHAR* spb) } ISC_event_fini(evnt_ptr); - THREAD_ENTER; + THREAD_ENTER(); } else { @@ -2233,7 +2233,7 @@ static void io_error( #ifdef MULTI_THREAD if (reenter_flag) - THREAD_ENTER; + THREAD_ENTER(); #endif ERR_post(isc_io_error, isc_arg_string, string, isc_arg_string, filename, @@ -2420,7 +2420,7 @@ static void service_fork(TEXT* service_path, Service* service) *p = ' '; } - THREAD_EXIT; + THREAD_EXIT(); STARTUPINFO start_crud; start_crud.cb = sizeof(STARTUPINFO); @@ -2449,7 +2449,7 @@ static void service_fork(TEXT* service_path, Service* service) CloseHandle(pipe_output); CloseHandle(pipe_error); } - THREAD_ENTER; + THREAD_ENTER(); if (argv_data != argv_data_buf) gds__free((SLONG *) argv_data); @@ -2809,10 +2809,10 @@ static void service_fork(pfn_svc_main service_executable, Service* service) if (!service->svc_stdout) /* NOMEM: */ ERR_post(isc_virmemexh, 0); - THREAD_EXIT; + THREAD_EXIT(); gds__thread_start(reinterpret_cast(service_executable), service, 0, 0, (void*)&service->svc_handle); - THREAD_ENTER; + THREAD_ENTER(); } @@ -3046,13 +3046,13 @@ static void service_fork(TEXT* service_path, Service* service) /* At last we can fork the sub-process. If the fork succeeds, repeat it so that we don't have defunct processes hanging around. */ - THREAD_EXIT; + THREAD_EXIT(); int pid; switch (pid = vfork()) { case -1: - THREAD_ENTER; + THREAD_ENTER(); if (argv != argv_buf) gds__free(argv); if (argv_data != argv_data_buf) @@ -3102,7 +3102,7 @@ static void service_fork(TEXT* service_path, Service* service) waitpid(pid, NULL, 0); - THREAD_ENTER; + THREAD_ENTER(); if (argv != argv_buf) gds__free(argv); diff --git a/src/jrd/thd.h b/src/jrd/thd.h index e20879235f..2bd1c0bf5e 100644 --- a/src/jrd/thd.h +++ b/src/jrd/thd.h @@ -26,7 +26,7 @@ * */ /* -$Id: thd.h,v 1.22 2004-05-09 05:47:59 robocop Exp $ +$Id: thd.h,v 1.23 2004-05-15 00:55:09 brodsom Exp $ */ #ifndef JRD_THD_H @@ -125,31 +125,6 @@ struct IB_RTL_CRITICAL_SECTION #define GET_THREAD_DATA gdbb #endif -#ifdef MULTI_THREAD -#ifdef SUPERSERVER -#define THREAD_ENTER SCH_enter() -#define THREAD_EXIT SCH_exit() -#define THREAD_VALIDATE SCH_validate() -#define SWEEP_THREAD -//#define GARBAGE_THREAD -#else -#define THREAD_ENTER gds__thread_enter() -#define THREAD_EXIT gds__thread_exit() -#define THREAD_VALIDATE -#define AST_THREAD -#endif -#define THREAD_SLEEP(msecs) THD_sleep (msecs) -#define THREAD_YIELD THD_yield() -#endif - -#ifndef THREAD_ENTER -#define THREAD_ENTER -#define THREAD_EXIT -#define THREAD_VALIDATE -#define THREAD_SLEEP(msecs) THD_sleep (msecs) -#define THREAD_YIELD -#endif - /* Thread priorities (may be ignored) */ const int THREAD_high = 1; @@ -233,6 +208,60 @@ typedef struct wlck_t { const int WLCK_read = 1; const int WLCK_write = 2; +// +// This stuff could be better located in the thd_proto.h +// +#include "../jrd/sch_proto.h" +#include "../jrd/thd_proto.h" + +#ifdef MULTI_THREAD +#ifdef SUPERSERVER +inline void THREAD_ENTER(){ + SCH_enter(); +} +inline void THREAD_EXIT(){ + SCH_exit(); +} +inline bool THREAD_VALIDATE(){ + return SCH_validate(); +} +#define SWEEP_THREAD +//#define GARBAGE_THREAD +#else // SUPERSERVER +inline void THREAD_ENTER(){ + gds__thread_enter(); +} +inline void THREAD_EXIT(){ + gds__thread_exit(); +} +inline bool THREAD_VALIDATE(){ + return false; +} +#define AST_THREAD +#endif // SUPERSERVER +inline void THREAD_SLEEP(ULONG msecs){ + THD_sleep(msecs); +} +inline void THREAD_YIELD(){ + THD_yield(); +} +#else // MULTI_THREAD +inline void THREAD_ENTER(){ +} +inline void THREAD_EXIT(){ +} +inline bool THREAD_VALIDATE(){ + return false; +} +inline void THREAD_SLEEP(ULONG msecs){ + THD_sleep(msecs); +} +inline void THREAD_YIELD(){ + THD_yield(); +} +#endif // MULTI_THREAD + + /* Threading allocation size */ #define THREAD_STRUCT_SIZE(type,n) (n * sizeof (type) + ALIGNMENT) diff --git a/src/jrd/tra.cpp b/src/jrd/tra.cpp index f22b96d33c..978b98d727 100644 --- a/src/jrd/tra.cpp +++ b/src/jrd/tra.cpp @@ -1278,8 +1278,8 @@ void TRA_set_state(thread_db* tdbb, jrd_tra* transaction, SLONG number, SSHORT s if (transaction && !(transaction->tra_flags & TRA_write)) return; else { - THREAD_EXIT; - THREAD_ENTER; + THREAD_EXIT(); + THREAD_ENTER(); tip = reinterpret_cast(CCH_FETCH(tdbb, &window, LCK_write, pag_transactions)); if (generation == tip->pag_generation) CCH_MARK_MUST_WRITE(tdbb, &window); diff --git a/src/jrd/val.cpp b/src/jrd/val.cpp index 0c5d8e7a3e..101d00bce7 100644 --- a/src/jrd/val.cpp +++ b/src/jrd/val.cpp @@ -1639,18 +1639,18 @@ static RTN walk_index(thread_db* tdbb, // If the index & relation contain different sets of records we // have a corrupt index if (control && (control->vdr_flags & vdr_records)) { - THREAD_EXIT; + THREAD_EXIT(); next_number = -1; while (SBM_next(control->vdr_rel_records, &next_number, RSE_get_forward)) { if (!SBM_test(control->vdr_idx_records, next_number)) { - THREAD_ENTER; + THREAD_ENTER(); return corrupt(tdbb, control, VAL_INDEX_MISSING_ROWS, relation, id + 1); } } - THREAD_ENTER; + THREAD_ENTER(); } return rtn_ok; diff --git a/src/jrd/vio.cpp b/src/jrd/vio.cpp index 7a8a17f909..1156d2369a 100644 --- a/src/jrd/vio.cpp +++ b/src/jrd/vio.cpp @@ -1003,9 +1003,9 @@ bool VIO_check_if_updated(thread_db* tdbb, record_param* rpb) } case tra_precommitted: - THREAD_EXIT; + THREAD_EXIT(); THREAD_SLEEP(100); /* milliseconds */ - THREAD_ENTER; + THREAD_ENTER(); break; case tra_limbo: @@ -1494,9 +1494,9 @@ void VIO_fini(thread_db* tdbb) dbb->dbb_flags &= ~DBB_garbage_collector; ISC_event_post(dbb->dbb_gc_event); /* Wake up running thread */ - THREAD_EXIT; + THREAD_EXIT(); ISC_event_wait(1, &gc_event_fini, &count, 0, NULL, 0); - THREAD_ENTER; + THREAD_ENTER(); /* Cleanup finalization event */ ISC_event_fini(gc_event_fini); } @@ -1856,9 +1856,9 @@ bool VIO_get_current( continue; } else if (state == tra_precommitted) { - THREAD_EXIT; + THREAD_EXIT(); THREAD_SLEEP(100); /* milliseconds */ - THREAD_ENTER; + THREAD_ENTER(); continue; } @@ -1885,9 +1885,9 @@ bool VIO_get_current( } if (state == tra_active) { - THREAD_EXIT; + THREAD_EXIT(); THREAD_SLEEP(100); /* milliseconds */ - THREAD_ENTER; + THREAD_ENTER(); continue; } } @@ -1980,9 +1980,9 @@ void VIO_init(thread_db* tdbb) { ERR_bugcheck_msg("cannot start thread"); } - THREAD_EXIT; + THREAD_EXIT(); ISC_event_wait(1, &gc_event_init, &count, 10 * 1000000, NULL, 0); - THREAD_ENTER; + THREAD_ENTER(); /* Clean up initialization event */ ISC_event_fini(gc_event_init); } @@ -3546,7 +3546,7 @@ static void THREAD_ROUTINE garbage_collector(Database* dbb) * improve query response time and throughput. * **************************************/ - THREAD_ENTER; + THREAD_ENTER(); CHECK_DBB(dbb); event_t* gc_event = dbb->dbb_gc_event; record_param rpb; @@ -3629,9 +3629,9 @@ static void THREAD_ROUTINE garbage_collector(Database* dbb) while (dbb->dbb_flags & DBB_suspend_bgio) { count = ISC_event_clear(gc_event); - THREAD_EXIT; + THREAD_EXIT(); ISC_event_wait(1, &gc_event, &count, 10 * 1000000, NULL, 0); - THREAD_ENTER; + THREAD_ENTER(); if (!(dbb->dbb_flags & DBB_garbage_collector)) { goto gc_exit; } @@ -3772,10 +3772,10 @@ rel_exit: continue; } dbb->dbb_flags &= ~DBB_gc_active; - THREAD_EXIT; + THREAD_EXIT(); int timeout = ISC_event_wait(1, &gc_event, &count, 10 * 1000000, NULL, 0); - THREAD_ENTER; + THREAD_ENTER(); dbb->dbb_flags |= DBB_gc_active; if (!timeout) { count = ISC_event_clear(gc_event); @@ -3814,7 +3814,7 @@ gc_exit: ISC_event_fini(gc_event); RESTORE_THREAD_DATA; - THREAD_EXIT; + THREAD_EXIT(); } // try catch (const std::exception&) { @@ -4301,9 +4301,9 @@ static int prepare_update( thread_db* tdbb, } if (state == tra_active) { - THREAD_EXIT; + THREAD_EXIT(); THREAD_SLEEP(100); /* milliseconds */ - THREAD_ENTER; + THREAD_ENTER(); continue; } } @@ -4357,9 +4357,9 @@ static int prepare_update( thread_db* tdbb, } if (state == tra_precommitted) { - THREAD_EXIT; + THREAD_EXIT(); THREAD_SLEEP(100); /* milliseconds */ - THREAD_ENTER; + THREAD_ENTER(); } else { VIO_backout(tdbb, rpb, transaction); diff --git a/src/jrd/why.cpp b/src/jrd/why.cpp index 3d930f663b..88a8c34082 100644 --- a/src/jrd/why.cpp +++ b/src/jrd/why.cpp @@ -42,7 +42,7 @@ * */ /* -$Id: why.cpp,v 1.68 2004-05-12 19:37:23 brodsom Exp $ +$Id: why.cpp,v 1.69 2004-05-15 00:55:09 brodsom Exp $ */ #include "firebird.h" @@ -6117,7 +6117,7 @@ static void subsystem_enter(void) THD_INIT; #endif - THREAD_ENTER; + THREAD_ENTER(); #if !(defined REQUESTER || defined SUPERCLIENT || defined SUPERSERVER) isc_enter_count++; if (subsystem_usage == 0 || @@ -6166,7 +6166,7 @@ static void subsystem_exit(void) } isc_enter_count--; #endif - THREAD_EXIT; + THREAD_EXIT(); } diff --git a/src/lock/lock.cpp b/src/lock/lock.cpp index 953fa83945..49906fef26 100644 --- a/src/lock/lock.cpp +++ b/src/lock/lock.cpp @@ -39,7 +39,7 @@ */ /* -$Id: lock.cpp,v 1.96 2004-05-13 19:47:30 brodsom Exp $ +$Id: lock.cpp,v 1.97 2004-05-15 00:57:23 brodsom Exp $ */ #include "firebird.h" @@ -4972,7 +4972,7 @@ static USHORT wait_for_request( monopolizing the engine */ #ifdef SUPERSERVER - THREAD_EXIT; + THREAD_EXIT(); #endif AST_ENABLE; ret = ISC_event_wait(1, &event_ptr, &value, @@ -4980,7 +4980,7 @@ static USHORT wait_for_request( lock_alarm_handler, event_ptr); AST_DISABLE; #ifdef SUPERSERVER - THREAD_ENTER; + THREAD_ENTER(); #endif } } @@ -4999,10 +4999,10 @@ static USHORT wait_for_request( The only thing we could do now is to wait. But let's do it without monopolizing the engine */ - THREAD_EXIT; + THREAD_EXIT(); ret = WaitForSingleObject(owner->own_wakeup_hndl, (timeout - current_time) * 1000); - THREAD_ENTER; + THREAD_ENTER(); #else ret = WaitForSingleObject(wakeup_event[0], (timeout - current_time) * 1000); #endif diff --git a/src/remote/inet.cpp b/src/remote/inet.cpp index 7d2545899f..f2baebce62 100644 --- a/src/remote/inet.cpp +++ b/src/remote/inet.cpp @@ -41,7 +41,7 @@ * */ /* -$Id: inet.cpp,v 1.105 2004-05-12 19:39:07 brodsom Exp $ +$Id: inet.cpp,v 1.106 2004-05-15 00:58:10 brodsom Exp $ */ #include "firebird.h" #include @@ -449,13 +449,13 @@ static bool port_mutex_inited = false; port_mutex_inited = true; \ THD_mutex_init (&port_mutex); \ } \ - THREAD_EXIT; \ + THREAD_EXIT(); \ THD_mutex_lock (&port_mutex); \ - THREAD_ENTER + THREAD_ENTER(); -#define STOP_PORT_CRITICAL THREAD_EXIT; \ +#define STOP_PORT_CRITICAL THREAD_EXIT(); \ THD_mutex_unlock (&port_mutex); \ - THREAD_ENTER + THREAD_ENTER(); #endif @@ -808,7 +808,7 @@ rem_port* INET_connect(const TEXT* name, (SCHAR*) &address.sin_addr, sizeof(address.sin_addr)); - THREAD_EXIT; + THREAD_EXIT(); const struct servent* service = getservbyname(protocol, "tcp"); #ifdef WIN_NT @@ -827,7 +827,7 @@ rem_port* INET_connect(const TEXT* name, } } #endif /* WIN_NT */ - THREAD_ENTER; + THREAD_ENTER(); /* Modification by luz (slightly modified by FSG) instead of failing here, try applying hard-wired @@ -898,10 +898,10 @@ rem_port* INET_connect(const TEXT* name, int n; if (packet) { - THREAD_EXIT; + THREAD_EXIT(); n = connect((SOCKET) port->port_handle, (struct sockaddr *) &address, sizeof(address)); - THREAD_ENTER; + THREAD_ENTER(); if (n != -1 && send_full(port, packet)) return port; else { @@ -1012,12 +1012,12 @@ rem_port* INET_connect(const TEXT* name, } while (true) { - THREAD_EXIT; + THREAD_EXIT(); socklen_t l = sizeof(address); SOCKET s = accept((SOCKET) port->port_handle, (struct sockaddr *) &address, &l); if (s == INVALID_SOCKET) { - THREAD_ENTER; + THREAD_ENTER(); inet_error(port, "accept", isc_net_connect_err, INET_ERRNO); disconnect(port); return NULL; @@ -1028,13 +1028,13 @@ rem_port* INET_connect(const TEXT* name, if ((flag & SRVR_debug) || !fork()) #endif { - THREAD_ENTER; + THREAD_ENTER(); SOCLOSE((SOCKET) port->port_handle); port->port_handle = (HANDLE) s; port->port_server_flags |= SRVR_server; return port; } - THREAD_ENTER; + THREAD_ENTER(); SOCLOSE(s); } } @@ -1499,9 +1499,9 @@ static rem_port* aux_connect(rem_port* port, PACKET* packet, t_event_ast ast) (SCHAR *) & address, response->p_resp_data.cstr_length); address.sin_family = AF_INET; - THREAD_EXIT; + THREAD_EXIT(); int status = connect(n, (struct sockaddr *) &address, sizeof(address)); - THREAD_ENTER; + THREAD_ENTER(); if (status < 0) { inet_error(port, "connect", isc_net_event_connect_err, INET_ERRNO); @@ -2008,7 +2008,7 @@ static int fork( SOCKET old_handle, USHORT flag) config = (LPQUERY_SERVICE_CONFIG) buffer; if (!QueryServiceConfig (service, config, sizeof(buffer), &config_len)) { - THREAD_ENTER; + THREAD_ENTER(); config = (LPQUERY_SERVICE_CONFIG) ALLR_alloc(config_len); /* NOMEM: ALLR_alloc handled */ /* FREE: later in this block */ @@ -2017,7 +2017,7 @@ static int fork( SOCKET old_handle, USHORT flag) strcpy(INET_command_line, config->lpBinaryPathName); if ((SCHAR *) config != buffer) { ALLR_free(config); - THREAD_EXIT; + THREAD_EXIT(); } CloseServiceHandle(service); } @@ -2099,7 +2099,7 @@ static in_addr get_host_address(const TEXT* name) **************************************/ in_addr address; - THREAD_EXIT; + THREAD_EXIT(); address.s_addr = inet_addr(name); @@ -2129,7 +2129,7 @@ static in_addr get_host_address(const TEXT* name) } } - THREAD_ENTER; + THREAD_ENTER(); return address; } @@ -2627,7 +2627,7 @@ static int select_wait( rem_port* main_port, SLCT * selct) return FALSE; } - THREAD_EXIT; + THREAD_EXIT(); ++selct->slct_width; for (;;) @@ -2662,7 +2662,7 @@ static int select_wait( rem_port* main_port, SLCT * selct) #endif } } - THREAD_ENTER; + THREAD_ENTER(); return TRUE; } else if (INTERRUPT_ERROR(INET_ERRNO)) @@ -2675,7 +2675,7 @@ static int select_wait( rem_port* main_port, SLCT * selct) break; #endif else { - THREAD_ENTER; + THREAD_ENTER(); sprintf(msg, "INET/select_wait: select failed, errno = %d", INET_ERRNO); gds__log(msg, 0); @@ -2683,7 +2683,7 @@ static int select_wait( rem_port* main_port, SLCT * selct) } } // for (;;) - THREAD_ENTER; + THREAD_ENTER(); } } @@ -3479,7 +3479,7 @@ static int packet_receive( FD_ZERO(&slct_fdset); FD_SET(ph, &slct_fdset); - THREAD_EXIT; + THREAD_EXIT(); int slct_count; for (;;) { #if (defined WIN_NT) @@ -3499,7 +3499,7 @@ static int packet_receive( break; } } - THREAD_ENTER; + THREAD_ENTER(); if (slct_count == -1) { @@ -3532,11 +3532,11 @@ static int packet_receive( } #endif /* REQUESTER */ - THREAD_EXIT; + THREAD_EXIT(); n = recv((SOCKET) port->port_handle, reinterpret_cast(buffer), buffer_length, 0); - THREAD_ENTER; + THREAD_ENTER(); if (n != -1 || !INTERRUPT_ERROR(INET_ERRNO)) break; } @@ -3598,7 +3598,7 @@ static bool_t packet_send( rem_port* port, const SCHAR* buffer, SSHORT buffer_le SSHORT length = buffer_length; while (length) { - THREAD_EXIT; + THREAD_EXIT(); #ifdef DEBUG if (INET_trace & TRACE_operations) { fprintf(stdout, "Before Send\n"); @@ -3613,7 +3613,7 @@ static bool_t packet_send( rem_port* port, const SCHAR* buffer, SSHORT buffer_le fflush(stdout); } #endif - THREAD_ENTER; + THREAD_ENTER(); if (n == length) { break; } @@ -3633,7 +3633,7 @@ static bool_t packet_send( rem_port* port, const SCHAR* buffer, SSHORT buffer_le if ((port->port_flags & PORT_async) && !(port->port_flags & PORT_no_oob)) { - THREAD_EXIT; + THREAD_EXIT(); int count = 0; SSHORT n; #ifdef SINIXZ @@ -3689,7 +3689,7 @@ static bool_t packet_send( rem_port* port, const SCHAR* buffer, SSHORT buffer_le } #endif /* HAVE_SETITIMER */ - THREAD_ENTER; + THREAD_ENTER(); if (n == -1) { return inet_error(port, "send/oob", isc_net_write_err, INET_ERRNO); } diff --git a/src/remote/inet_server.cpp b/src/remote/inet_server.cpp index 2c429ce491..fd1707e500 100644 --- a/src/remote/inet_server.cpp +++ b/src/remote/inet_server.cpp @@ -32,7 +32,7 @@ * */ /* -$Id: inet_server.cpp,v 1.39 2004-05-06 18:08:41 brodsom Exp $ +$Id: inet_server.cpp,v 1.40 2004-05-15 00:58:10 brodsom Exp $ */ #include "firebird.h" #include @@ -339,10 +339,10 @@ int CLIB_ROUTINE server_main( int argc, char** argv) } { // scope block ISC_STATUS_ARRAY status_vector; - THREAD_ENTER; + THREAD_ENTER(); port = INET_connect(protocol, 0, status_vector, INET_SERVER_flag, 0, 0); - THREAD_EXIT; + THREAD_EXIT(); if (!port) { gds__print_status(status_vector); exit(STARTUP_ERROR); @@ -353,9 +353,9 @@ int CLIB_ROUTINE server_main( int argc, char** argv) #ifdef VMS channel = assign("SYS$INPUT"); #endif - THREAD_ENTER; + THREAD_ENTER(); port = INET_server(channel); - THREAD_EXIT; + THREAD_EXIT(); if (!port) { fprintf(stderr, "fbserver: Unable to start INET_server\n"); exit(STARTUP_ERROR); diff --git a/src/remote/interface.cpp b/src/remote/interface.cpp index ce3f912765..bba8ef10af 100644 --- a/src/remote/interface.cpp +++ b/src/remote/interface.cpp @@ -5522,9 +5522,9 @@ static void THREAD_ROUTINE event_thread( rem_port* port) /* read what should be an event message */ - THREAD_ENTER; + THREAD_ENTER(); rem_port* stuff = port->receive(&packet); - THREAD_EXIT; + THREAD_EXIT(); const P_OP operation = packet.p_operation; @@ -5542,9 +5542,9 @@ static void THREAD_ROUTINE event_thread( rem_port* port) if (operation == op_event) { P_EVENT* pevent = &packet.p_event; - THREAD_ENTER; + THREAD_ENTER(); RVNT event = find_event(port, pevent->p_event_rid); - THREAD_EXIT; + THREAD_EXIT(); if (event) { /* Call the asynchronous event routine associated @@ -6992,9 +6992,9 @@ static void send_cancel_event(RVNT event) if (event->rvnt_id) { - THREAD_EXIT; + THREAD_EXIT(); (*event->rvnt_ast)(event->rvnt_arg, (USHORT) 0, NULL); - THREAD_ENTER; + THREAD_ENTER(); event->rvnt_id = 0; } } @@ -7084,7 +7084,7 @@ static void server_death(rem_port* port) * Cleanup events. * **************************************/ - THREAD_ENTER; + THREAD_ENTER(); RDB rdb = port->port_context; if (!(port->port_flags & PORT_disconnect)) @@ -7093,16 +7093,16 @@ static void server_death(rem_port* port) { if (event->rvnt_id) { - THREAD_EXIT; + THREAD_EXIT(); (*event->rvnt_ast) (event->rvnt_arg, (USHORT) 0, NULL); - THREAD_ENTER; + THREAD_ENTER(); event->rvnt_id = 0; } } } port->disconnect(); - THREAD_EXIT; + THREAD_EXIT(); } #endif diff --git a/src/remote/os/win32/cntl.cpp b/src/remote/os/win32/cntl.cpp index c5ddc26965..a57885f17c 100644 --- a/src/remote/os/win32/cntl.cpp +++ b/src/remote/os/win32/cntl.cpp @@ -90,12 +90,12 @@ void *CNTL_insert_thread(void) * Functional description * **************************************/ - THREAD_ENTER; + THREAD_ENTER(); THREAD new_thread = (THREAD) ALLR_alloc((SLONG) sizeof(struct thread)); /* NOMEM: ALLR_alloc() handled */ /* FREE: in CTRL_remove_thread() */ - THREAD_EXIT; + THREAD_EXIT(); DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &new_thread->thread_handle, 0, FALSE, DUPLICATE_SAME_ACCESS); @@ -220,9 +220,9 @@ void CNTL_remove_thread( void *thread) THREAD this_thread = (THREAD) thread; CloseHandle(this_thread->thread_handle); - THREAD_ENTER; + THREAD_ENTER(); ALLR_free(thread); - THREAD_EXIT; + THREAD_EXIT(); } @@ -355,7 +355,7 @@ static int cleanup_thread(void *lpv) } - THREAD_ENTER; + THREAD_ENTER(); JRD_shutdown_all(); /* There is no THREAD_EXIT to help ensure that no diff --git a/src/remote/os/win32/srvr_w32.cpp b/src/remote/os/win32/srvr_w32.cpp index cc0d35eaaf..174af27463 100644 --- a/src/remote/os/win32/srvr_w32.cpp +++ b/src/remote/os/win32/srvr_w32.cpp @@ -240,14 +240,14 @@ int WINAPI WinMain(HINSTANCE hThisInst, } if (connection_handle != INVALID_HANDLE_VALUE) { - THREAD_ENTER; + THREAD_ENTER(); if (server_flag & SRVR_inet) port = INET_reconnect(connection_handle, status_vector); else if (server_flag & SRVR_wnet) port = WNET_reconnect(connection_handle, status_vector); else if (server_flag & SRVR_xnet) port = XNET_reconnect((ULONG) connection_handle, status_vector); - THREAD_EXIT; + THREAD_EXIT(); if (port) { service_connection(port); } @@ -295,7 +295,7 @@ int WINAPI WinMain(HINSTANCE hThisInst, HANDLE hEvent = ISC_make_signal(TRUE, TRUE, GetCurrentProcessId(), SIGSHUT); WaitForSingleObject(hEvent, INFINITE); - THREAD_ENTER; + THREAD_ENTER(); JRD_shutdown_all(); } } @@ -360,9 +360,9 @@ static void THREAD_ROUTINE inet_connect_wait_thread( void* dummy) if (!(server_flag & SRVR_non_service)) thread = CNTL_insert_thread(); - THREAD_ENTER; + THREAD_ENTER(); port = INET_connect(protocol_inet, 0, status_vector, server_flag, 0, 0); - THREAD_EXIT; + THREAD_EXIT(); if (port) SRVR_multi_thread(port, server_flag); else @@ -393,9 +393,9 @@ static void THREAD_ROUTINE wnet_connect_wait_thread( void *dummy) while (true) { - THREAD_ENTER; + THREAD_ENTER(); rem_port* port = WNET_connect(protocol_wnet, 0, status_vector, server_flag); - THREAD_EXIT; + THREAD_EXIT(); if (!port) { if (status_vector[1] != isc_io_error || status_vector[6] != isc_arg_win32 || @@ -460,9 +460,9 @@ static void THREAD_ROUTINE xnet_connect_wait_thread(void *dummy) if (!(server_flag & SRVR_non_service)) thread = CNTL_insert_thread(); - THREAD_ENTER; + THREAD_ENTER(); XNET_srv(server_flag); - THREAD_EXIT; + THREAD_EXIT(); if (!(server_flag & SRVR_non_service)) CNTL_remove_thread(thread); diff --git a/src/remote/os/win32/window.cpp b/src/remote/os/win32/window.cpp index b98790ab5d..92c20c84e7 100644 --- a/src/remote/os/win32/window.cpp +++ b/src/remote/os/win32/window.cpp @@ -261,7 +261,7 @@ LRESULT CALLBACK WindowFunc(HWND hWnd, #ifdef DEV_BUILD gds_alloc_report(ALLOC_verbose, "from server", 0); #endif - THREAD_ENTER; + THREAD_ENTER(); JRD_shutdown_all(); DestroyWindow(hWnd); diff --git a/src/remote/os/win32/winmain.cpp b/src/remote/os/win32/winmain.cpp index 42d7dce580..8fc9bc5054 100644 --- a/src/remote/os/win32/winmain.cpp +++ b/src/remote/os/win32/winmain.cpp @@ -82,7 +82,7 @@ void SRVR_WinMain( PACKET send, receive; zap_packet(&receive); zap_packet(&send); - THREAD_ENTER; + THREAD_ENTER(); set_server(main_port, flags); if (WSASetBlockingHook((FARPROC) BlockingHook)) { @@ -120,7 +120,7 @@ void SRVR_WinMain( } } - THREAD_EXIT; + THREAD_EXIT(); } diff --git a/src/remote/os/win32/wnet.cpp b/src/remote/os/win32/wnet.cpp index 2287af1849..2f8bdb8672 100644 --- a/src/remote/os/win32/wnet.cpp +++ b/src/remote/os/win32/wnet.cpp @@ -358,7 +358,7 @@ rem_port* WNET_connect(const TEXT* name, if (packet) { - THREAD_EXIT; + THREAD_EXIT(); while (true) { port->port_handle = CreateFile(port->port_connection->str_data, GENERIC_WRITE | GENERIC_READ, @@ -368,14 +368,14 @@ rem_port* WNET_connect(const TEXT* name, } const ISC_STATUS status = GetLastError(); if (status != ERROR_PIPE_BUSY) { - THREAD_ENTER; + THREAD_ENTER(); wnet_error(port, "CreateFile", isc_net_connect_err, status); disconnect(port); return NULL; } WaitNamedPipe(port->port_connection->str_data, 3000L); } - THREAD_ENTER; + THREAD_ENTER(); send_full(port, packet); return port; } @@ -385,7 +385,7 @@ rem_port* WNET_connect(const TEXT* name, LPSECURITY_ATTRIBUTES security_attr; security_attr = ISC_get_security_desc(); - THREAD_EXIT; + THREAD_EXIT(); TEXT command_line[MAXPATHLEN + 32]; command_line[0] = 0; TEXT* p = 0; @@ -407,7 +407,7 @@ rem_port* WNET_connect(const TEXT* name, // TMN: The check for GetLastError() is redundant. // This code should NEVER be called if not running on NT, // since Win9x does not support the server side of named pipes! - THREAD_ENTER; + THREAD_ENTER(); wnet_error(port, "CreateNamedPipe", isc_net_connect_listen_err, ERRNO); disconnect(port); @@ -417,7 +417,7 @@ rem_port* WNET_connect(const TEXT* name, if (!ConnectNamedPipe(port->port_handle, 0) && GetLastError() != ERROR_PIPE_CONNECTED) { - THREAD_ENTER; + THREAD_ENTER(); wnet_error(port, "ConnectNamedPipe", isc_net_connect_err, ERRNO); disconnect(port); return NULL; @@ -425,7 +425,7 @@ rem_port* WNET_connect(const TEXT* name, if (flag & (SRVR_debug | SRVR_multi_client)) { - THREAD_ENTER; + THREAD_ENTER(); port->port_server_flags |= SRVR_server; if (flag & SRVR_multi_client) { @@ -458,7 +458,7 @@ rem_port* WNET_connect(const TEXT* name, config = (LPQUERY_SERVICE_CONFIG) buffer; if (!QueryServiceConfig (service, config, sizeof(buffer), &config_len)) { - THREAD_ENTER; + THREAD_ENTER(); config = (LPQUERY_SERVICE_CONFIG) ALLR_alloc(config_len); /* NOMEM: handled by ALLR_alloc, FREE: in this block */ QueryServiceConfig(service, config, config_len, @@ -467,7 +467,7 @@ rem_port* WNET_connect(const TEXT* name, sprintf(command_line, "%s -s", config->lpBinaryPathName); if ((SCHAR *) config != buffer) { ALLR_free(config); - THREAD_EXIT; + THREAD_EXIT(); } CloseServiceHandle(service); } @@ -773,7 +773,7 @@ static rem_port* aux_connect( rem_port* port, PACKET* packet, t_event_ast ast) new_port->port_connection = make_pipe_name(port->port_connection->str_data, EVENT_PIPE_SUFFIX, p); - THREAD_EXIT; + THREAD_EXIT(); while (true) { new_port->port_handle = CreateFile(new_port->port_connection->str_data, GENERIC_READ, 0, @@ -782,14 +782,14 @@ static rem_port* aux_connect( rem_port* port, PACKET* packet, t_event_ast ast) break; const ISC_STATUS status = GetLastError(); if (status != ERROR_PIPE_BUSY) { - THREAD_ENTER; + THREAD_ENTER(); return (rem_port*) wnet_error(new_port, "CreateFile", isc_net_event_connect_err, status); } WaitNamedPipe(new_port->port_connection->str_data, 3000L); } - THREAD_ENTER; + THREAD_ENTER(); new_port->port_flags = port->port_flags & PORT_no_oob; @@ -827,7 +827,7 @@ static rem_port* aux_request( rem_port* vport, PACKET* packet) make_pipe_name(vport->port_connection->str_data, EVENT_PIPE_SUFFIX, str_pid); LPSECURITY_ATTRIBUTES security_attr = ISC_get_security_desc(); - THREAD_EXIT; + THREAD_EXIT(); new_port->port_handle = CreateNamedPipe(new_port->port_connection->str_data, PIPE_ACCESS_DUPLEX, @@ -837,7 +837,7 @@ static rem_port* aux_request( rem_port* vport, PACKET* packet) MAX_DATA, 0, security_attr); - THREAD_ENTER; + THREAD_ENTER(); if (new_port->port_handle == INVALID_HANDLE_VALUE) { wnet_error(new_port, "CreateNamedPipe", isc_net_event_listen_err, ERRNO); @@ -1617,10 +1617,10 @@ static int packet_receive( **************************************/ DWORD n = 0; - THREAD_EXIT; + THREAD_EXIT(); const USHORT status = ReadFile(port->port_handle, buffer, buffer_length, &n, NULL); - THREAD_ENTER; + THREAD_ENTER(); if (!status && GetLastError() != ERROR_BROKEN_PIPE) return wnet_error(port, "ReadFile", isc_net_read_err, ERRNO); if (!n) @@ -1653,10 +1653,10 @@ static int packet_send( rem_port* port, const SCHAR* buffer, SSHORT buffer_lengt const SCHAR* data = buffer; const DWORD length = buffer_length; - THREAD_EXIT; + THREAD_EXIT(); DWORD n; const USHORT status = WriteFile(port->port_handle, data, length, &n, NULL); - THREAD_ENTER; + THREAD_ENTER(); if (!status) return wnet_error(port, "WriteFile", isc_net_write_err, ERRNO); if (n != length) diff --git a/src/remote/server.cpp b/src/remote/server.cpp index 10df3751d0..689296fe3d 100644 --- a/src/remote/server.cpp +++ b/src/remote/server.cpp @@ -228,7 +228,7 @@ void SRVR_main(rem_port* main_port, USHORT flags) PACKET send, receive; zap_packet(&receive, true); zap_packet(&send, true); - THREAD_ENTER; + THREAD_ENTER(); set_server(main_port, flags); while (true) @@ -245,7 +245,7 @@ void SRVR_main(rem_port* main_port, USHORT flags) } } - THREAD_EXIT; + THREAD_EXIT(); } @@ -276,7 +276,7 @@ void SRVR_multi_thread( rem_port* main_port, USHORT flags) gds__thread_enable(-1); - THREAD_ENTER; + THREAD_ENTER(); SET_THREAD_DATA; trdb->trdb_status_vector = status_vector; @@ -330,9 +330,9 @@ void SRVR_multi_thread( rem_port* main_port, USHORT flags) request and hope another thread will free memory or request blocks that we can then use. */ - THREAD_EXIT; + THREAD_EXIT(); THREAD_SLEEP(1 * 1000); - THREAD_ENTER; + THREAD_ENTER(); continue; } } @@ -352,7 +352,7 @@ void SRVR_multi_thread( rem_port* main_port, USHORT flags) if (!(port = main_port->receive(&request->req_receive))) { gds__log("SRVR_multi_thread/RECEIVE: error on main_port, shutting down"); - THREAD_EXIT; + THREAD_EXIT(); RESTORE_THREAD_DATA; return; } @@ -463,7 +463,7 @@ void SRVR_multi_thread( rem_port* main_port, USHORT flags) } /* We should never get to this point */ - THREAD_EXIT; + THREAD_EXIT(); } // try catch (const std::exception&) @@ -535,7 +535,7 @@ void SRVR_multi_thread( rem_port* main_port, USHORT flags) gds__log("SRVR_multi_thread: error during startup, shutting down"); RESTORE_THREAD_DATA; - THREAD_EXIT; + THREAD_EXIT(); return; } @@ -651,9 +651,9 @@ static ISC_STATUS allocate_statement( rem_port* port, P_RLSE * allocate, PACKET* RDB rdb = port->port_context; FB_API_HANDLE handle = 0; - THREAD_EXIT; + THREAD_EXIT(); GDS_DSQL_ALLOCATE(status_vector, &rdb->rdb_handle, &handle); - THREAD_ENTER; + THREAD_ENTER(); OBJCT object; if (status_vector[1]) @@ -672,9 +672,9 @@ static ISC_STATUS allocate_statement( rem_port* port, P_RLSE * allocate, PACKET* } else { object = 0; - THREAD_EXIT; + THREAD_EXIT(); GDS_DSQL_FREE(status_vector, &statement->rsr_handle, DSQL_drop); - THREAD_ENTER; + THREAD_ENTER(); ALLR_release(statement); status_vector[0] = isc_arg_gds; status_vector[1] = isc_too_many_handles; @@ -788,7 +788,7 @@ static ISC_STATUS attach_database( they will be stuffed in the DPB if so. */ REMOTE_get_timeout_params(port, dpb, dl); - THREAD_EXIT; + THREAD_EXIT(); if (operation == op_attach) { isc_attach_database(status_vector, l, file, @@ -799,7 +799,7 @@ static ISC_STATUS attach_database( isc_create_database(status_vector, l, file, &handle, dl, reinterpret_cast(dpb), 0); } - THREAD_ENTER; + THREAD_ENTER(); if (new_dpb != new_dpb_buffer) { ALLR_free(new_dpb); @@ -932,9 +932,9 @@ static ISC_STATUS cancel_events( rem_port* port, P_EVENT * stuff, PACKET* send) /* cancel the event */ if (event->rvnt_id) { - THREAD_EXIT; + THREAD_EXIT(); isc_cancel_events(status_vector, &rdb->rdb_handle, &event->rvnt_id); - THREAD_ENTER; + THREAD_ENTER(); } /* zero event info */ @@ -975,11 +975,11 @@ static void cancel_operation( rem_port* port) { if (!(rdb->rdb_flags & RDB_service)) { - THREAD_EXIT; + THREAD_EXIT(); ISC_STATUS_ARRAY status_vector; gds__cancel_operation(status_vector, (FB_API_HANDLE*) &rdb->rdb_handle, CANCEL_raise); - THREAD_ENTER; + THREAD_ENTER(); } } } @@ -1027,7 +1027,7 @@ static USHORT check_statement_type( RSR statement) USHORT ret = STMT_OTHER; bool done = false; - THREAD_EXIT; + THREAD_EXIT(); if (!GDS_DSQL_SQL_INFO(local_status, &statement->rsr_handle, sizeof(sql_info), (const SCHAR*) sql_info, sizeof(buffer), reinterpret_cast(buffer))) @@ -1059,7 +1059,7 @@ static USHORT check_statement_type( RSR statement) info += 3 + l; } } - THREAD_ENTER; + THREAD_ENTER(); return ret; } @@ -1084,10 +1084,10 @@ ISC_STATUS rem_port::compile(P_CMPL* compileL, PACKET* sendL) const UCHAR* blr = compileL->p_cmpl_blr.cstr_address; USHORT blr_length = compileL->p_cmpl_blr.cstr_length; - THREAD_EXIT; + THREAD_EXIT(); isc_compile_request(status_vector, &rdb->rdb_handle, &handle, blr_length, reinterpret_cast(blr)); - THREAD_ENTER; + THREAD_ENTER(); if (status_vector[1]) return this->send_response(sendL, 0, 0, status_vector); @@ -1119,9 +1119,9 @@ ISC_STATUS rem_port::compile(P_CMPL* compileL, PACKET* sendL) rdb->rdb_requests = requestL; } else { - THREAD_EXIT; + THREAD_EXIT(); isc_release_request(status_vector, &requestL->rrq_handle); - THREAD_ENTER; + THREAD_ENTER(); ALLR_release(requestL); status_vector[0] = isc_arg_gds; status_vector[1] = isc_too_many_handles; @@ -1174,10 +1174,10 @@ ISC_STATUS rem_port::ddl(P_DDL* ddlL, PACKET* sendL) const UCHAR* blr = ddlL->p_ddl_blr.cstr_address; const USHORT blr_length = ddlL->p_ddl_blr.cstr_length; - THREAD_EXIT; + THREAD_EXIT(); isc_ddl(status_vector, &rdb->rdb_handle, &transaction->rtr_handle, blr_length, reinterpret_cast(blr)); - THREAD_ENTER; + THREAD_ENTER(); return this->send_response(sendL, 0, 0, status_vector); } @@ -1231,10 +1231,10 @@ void rem_port::disconnect(PACKET* sendL, PACKET* receiveL) /* Prevent a pending or spurious cancel from aborting a good, clean detach from the database. */ - THREAD_EXIT; + THREAD_EXIT(); gds__cancel_operation(status_vector, (FB_API_HANDLE*) &rdb->rdb_handle, CANCEL_disable); - THREAD_ENTER; + THREAD_ENTER(); #endif while (rdb->rdb_requests) release_request(rdb->rdb_requests); @@ -1242,7 +1242,7 @@ void rem_port::disconnect(PACKET* sendL, PACKET* receiveL) release_sql_request(rdb->rdb_sql_requests); RTR transaction; while (transaction = rdb->rdb_transactions) { - THREAD_EXIT; + THREAD_EXIT(); if (!(transaction->rtr_flags & RTR_limbo)) isc_rollback_transaction(status_vector, &transaction->rtr_handle); @@ -1258,12 +1258,12 @@ void rem_port::disconnect(PACKET* sendL, PACKET* receiveL) gds__handle_cleanup(status_vector, (FB_API_HANDLE*) &transaction->rtr_handle); #endif - THREAD_ENTER; + THREAD_ENTER(); release_transaction(rdb->rdb_transactions); } - THREAD_EXIT; + THREAD_EXIT(); isc_detach_database(status_vector, &rdb->rdb_handle); - THREAD_ENTER; + THREAD_ENTER(); while (rdb->rdb_events) { release_event(rdb->rdb_events); } @@ -1273,9 +1273,9 @@ void rem_port::disconnect(PACKET* sendL, PACKET* receiveL) } else { - THREAD_EXIT; + THREAD_EXIT(); isc_service_detach(status_vector, &rdb->rdb_handle); - THREAD_ENTER; + THREAD_ENTER(); } REMOTE_free_packet(this, sendL); @@ -1360,9 +1360,9 @@ void rem_port::drop_database(P_RLSE* release, PACKET* sendL) RDB rdb = this->port_context; - THREAD_EXIT; + THREAD_EXIT(); isc_drop_database(status_vector, &rdb->rdb_handle); - THREAD_ENTER; + THREAD_ENTER(); if (status_vector[1] && (status_vector[1] != isc_drdb_completed_with_errs)) @@ -1441,12 +1441,12 @@ ISC_STATUS rem_port::end_blob(P_OP operation, P_RLSE * release, PACKET* sendL) release->p_rlse_object, isc_bad_segstr_handle); - THREAD_EXIT; + THREAD_EXIT(); if (operation == op_close_blob) isc_close_blob(status_vector, &blob->rbl_handle); else isc_cancel_blob(status_vector, &blob->rbl_handle); - THREAD_ENTER; + THREAD_ENTER(); if (!status_vector[1]) { release_blob(blob); @@ -1472,9 +1472,9 @@ ISC_STATUS rem_port::end_database(P_RLSE * release, PACKET* sendL) RDB rdb = this->port_context; - THREAD_EXIT; + THREAD_EXIT(); isc_detach_database(status_vector,&rdb->rdb_handle); - THREAD_ENTER; + THREAD_ENTER(); if (status_vector[1]) return this->send_response(sendL, 0, 0, status_vector); @@ -1519,9 +1519,9 @@ ISC_STATUS rem_port::end_request(P_RLSE * release, PACKET* sendL) release->p_rlse_object, isc_bad_req_handle); - THREAD_EXIT; + THREAD_EXIT(); isc_release_request(status_vector, &requestL->rrq_handle); - THREAD_ENTER; + THREAD_ENTER(); if (!status_vector[1]) release_request(requestL); @@ -1551,11 +1551,11 @@ ISC_STATUS rem_port::end_statement(P_SQLFREE* free_stmt, PACKET* sendL) free_stmt->p_sqlfree_statement, isc_bad_req_handle); - THREAD_EXIT; + THREAD_EXIT(); GDS_DSQL_FREE(status_vector, &statement->rsr_handle, free_stmt->p_sqlfree_option); - THREAD_ENTER; + THREAD_ENTER(); if (status_vector[1]) return this->send_response(sendL, 0, 0, status_vector); @@ -1598,7 +1598,7 @@ ISC_STATUS rem_port::end_transaction(P_OP operation, P_RLSE * release, PACKET* s release->p_rlse_object, isc_bad_trans_handle); - THREAD_EXIT; + THREAD_EXIT(); switch (operation) { case op_commit: @@ -1622,7 +1622,7 @@ ISC_STATUS rem_port::end_transaction(P_OP operation, P_RLSE * release, PACKET* s transaction->rtr_flags |= RTR_limbo; break; } - THREAD_ENTER; + THREAD_ENTER(); if (!status_vector[1]) if (operation == op_commit || operation == op_rollback) { @@ -1726,7 +1726,7 @@ ISC_STATUS rem_port::execute_immediate(P_OP op, P_SQLST * exnow, PACKET* sendL) parser_version = (this->port_protocol < PROTOCOL_VERSION10) ? 1 : 2; - THREAD_EXIT; + THREAD_EXIT(); GDS_DSQL_EXECUTE_IMMED(status_vector, &rdb->rdb_handle, &handle, @@ -1744,7 +1744,7 @@ ISC_STATUS rem_port::execute_immediate(P_OP op, P_SQLST * exnow, PACKET* sendL) out_msg_type, out_msg_length, reinterpret_cast(out_msg)); - THREAD_ENTER; + THREAD_ENTER(); if (op == op_exec_immediate2) { @@ -1844,7 +1844,7 @@ ISC_STATUS rem_port::execute_statement(P_OP op, P_SQLDATA* sqldata, PACKET* send FB_API_HANDLE handle = (transaction) ? transaction->rtr_handle : 0; - THREAD_EXIT; + THREAD_EXIT(); GDS_DSQL_EXECUTE(status_vector, &handle, &statement->rsr_handle, @@ -1858,7 +1858,7 @@ ISC_STATUS rem_port::execute_statement(P_OP op, P_SQLDATA* sqldata, PACKET* send out_msg_type, out_msg_length, reinterpret_cast(out_msg)); - THREAD_ENTER; + THREAD_ENTER(); if (op == op_execute2) { @@ -1992,7 +1992,7 @@ ISC_STATUS rem_port::fetch(P_SQLDATA * sqldata, PACKET* sendL) if (!message->msg_address) { fb_assert(statement->rsr_msgs_waiting == 0); - THREAD_EXIT; + THREAD_EXIT(); s = GDS_DSQL_FETCH(status_vector, &statement->rsr_handle, sqldata->p_sqldata_blr.cstr_length, @@ -2001,7 +2001,7 @@ ISC_STATUS rem_port::fetch(P_SQLDATA * sqldata, PACKET* sendL) msg_length, reinterpret_cast(message->msg_buffer)); - THREAD_ENTER; + THREAD_ENTER(); statement->rsr_flags |= RSR_fetched; if (s) { if (s == 100 || s == 101) { @@ -2069,7 +2069,7 @@ ISC_STATUS rem_port::fetch(P_SQLDATA * sqldata, PACKET* sendL) next->msg_next = message; next = message; } - THREAD_EXIT; + THREAD_EXIT(); s = GDS_DSQL_FETCH(status_vector, &statement->rsr_handle, sqldata->p_sqldata_blr.cstr_length, @@ -2077,7 +2077,7 @@ ISC_STATUS rem_port::fetch(P_SQLDATA * sqldata, PACKET* sendL) sqldata->p_sqldata_message_number, msg_length, reinterpret_cast(message->msg_buffer)); - THREAD_ENTER; + THREAD_ENTER(); if (s) { if (status_vector[1]) { /* If already have an error queued, don't overwrite it */ @@ -2141,7 +2141,7 @@ ISC_STATUS rem_port::fetch_blob(P_SQLDATA * sqldata, PACKET* sendL) ISC_STATUS s = 0; message = statement->rsr_buffer; - THREAD_EXIT; + THREAD_EXIT(); s = GDS_DSQL_FETCH(status_vector, &statement->rsr_handle, sqldata->p_sqldata_blr.cstr_length, @@ -2149,7 +2149,7 @@ ISC_STATUS rem_port::fetch_blob(P_SQLDATA * sqldata, PACKET* sendL) sqldata->p_sqldata_message_number, msg_length, reinterpret_cast(message->msg_buffer)); - THREAD_ENTER; + THREAD_ENTER(); if (!status_vector[1] || status_vector[1] != isc_segment || status_vector[1] != isc_segstr_eof) @@ -2229,11 +2229,11 @@ static bool get_next_msg_no(rrq* request, ISC_STATUS_ARRAY status_vector; UCHAR info_buffer[128]; - THREAD_EXIT; + THREAD_EXIT(); isc_request_info(status_vector, &request->rrq_handle, incarnation, sizeof(request_info), reinterpret_cast(request_info), sizeof(info_buffer), reinterpret_cast(info_buffer)); - THREAD_ENTER; + THREAD_ENTER(); if (status_vector[1]) return false; @@ -2314,11 +2314,11 @@ ISC_STATUS rem_port::get_segment(P_SGMT* segment, PACKET* sendL) if (this->port_flags & PORT_rpc) { length = 0; - THREAD_EXIT; + THREAD_EXIT(); isc_get_segment(status_vector, &blob->rbl_handle, &length, segment->p_sgmt_length, reinterpret_cast(buffer)); - THREAD_ENTER; + THREAD_ENTER(); const ISC_STATUS status = this->send_response(sendL, blob->rbl_id, length, status_vector); #ifdef DEBUG_REMOTE_MEMORY @@ -2342,10 +2342,10 @@ ISC_STATUS rem_port::get_segment(P_SGMT* segment, PACKET* sendL) while (buffer_length > 2) { buffer_length -= 2; p += 2; - THREAD_EXIT; + THREAD_EXIT(); isc_get_segment(status_vector, &blob->rbl_handle, &length, buffer_length, reinterpret_cast(p)); - THREAD_ENTER; + THREAD_ENTER(); if (status_vector[1] == isc_segstr_eof) { state = 2; @@ -2430,7 +2430,7 @@ ISC_STATUS rem_port::get_slice(P_SLC * stuff, PACKET* sendL) } P_SLR* response = &sendL->p_slr; - THREAD_EXIT; + THREAD_EXIT(); isc_get_slice(status_vector, &rdb->rdb_handle, &transaction->rtr_handle, (ISC_QUAD*) &stuff->p_slc_id, stuff->p_slc_sdl.cstr_length, reinterpret_cast(stuff->p_slc_sdl.cstr_address), @@ -2438,7 +2438,7 @@ ISC_STATUS rem_port::get_slice(P_SLC * stuff, PACKET* sendL) (const ISC_LONG*) stuff->p_slc_parameters.cstr_address, stuff->p_slc_length, slice, reinterpret_cast(&response->p_slr_length)); - THREAD_ENTER; + THREAD_ENTER(); ISC_STATUS status; if (status_vector[1]) @@ -2512,17 +2512,17 @@ ISC_STATUS rem_port::info(P_OP op, P_INFO * stuff, PACKET* sendL) type_rbl, stuff->p_info_object, isc_bad_segstr_handle); - THREAD_EXIT; + THREAD_EXIT(); isc_blob_info(status_vector, &blob->rbl_handle, stuff->p_info_items.cstr_length, reinterpret_cast(stuff->p_info_items.cstr_address), stuff->p_info_buffer_length, reinterpret_cast(buffer)); - THREAD_ENTER; + THREAD_ENTER(); break; case op_info_database: - THREAD_EXIT; + THREAD_EXIT(); isc_database_info(status_vector, &rdb->rdb_handle, stuff->p_info_items.cstr_length, reinterpret_cast(stuff->p_info_items.cstr_address), @@ -2538,7 +2538,7 @@ ISC_STATUS rem_port::info(P_OP op, P_INFO * stuff, PACKET* sendL) reinterpret_cast(this->port_host->str_data), 0); } - THREAD_ENTER; + THREAD_ENTER(); break; case op_info_request: @@ -2548,14 +2548,14 @@ ISC_STATUS rem_port::info(P_OP op, P_INFO * stuff, PACKET* sendL) type_rrq, stuff->p_info_object, isc_bad_req_handle); - THREAD_EXIT; + THREAD_EXIT(); isc_request_info(status_vector, &requestL->rrq_handle, stuff->p_info_incarnation, stuff->p_info_items.cstr_length, reinterpret_cast(stuff->p_info_items.cstr_address), stuff->p_info_buffer_length, reinterpret_cast(buffer)); - THREAD_ENTER; + THREAD_ENTER(); break; case op_info_transaction: @@ -2564,17 +2564,17 @@ ISC_STATUS rem_port::info(P_OP op, P_INFO * stuff, PACKET* sendL) type_rtr, stuff->p_info_object, isc_bad_trans_handle); - THREAD_EXIT; + THREAD_EXIT(); isc_transaction_info(status_vector, &transaction->rtr_handle, stuff->p_info_items.cstr_length, reinterpret_cast(stuff->p_info_items.cstr_address), stuff->p_info_buffer_length, reinterpret_cast < char *>(buffer)); - THREAD_ENTER; + THREAD_ENTER(); break; case op_service_info: - THREAD_EXIT; + THREAD_EXIT(); isc_service_query(status_vector, &rdb->rdb_handle, NULL, @@ -2586,7 +2586,7 @@ ISC_STATUS rem_port::info(P_OP op, P_INFO * stuff, PACKET* sendL) const char*>(stuff->p_info_recv_items.cstr_address), stuff->p_info_buffer_length, reinterpret_cast(buffer)); - THREAD_ENTER; + THREAD_ENTER(); break; case op_info_sql: @@ -2595,7 +2595,7 @@ ISC_STATUS rem_port::info(P_OP op, P_INFO * stuff, PACKET* sendL) type_rsr, stuff->p_info_object, isc_bad_req_handle); - THREAD_EXIT; + THREAD_EXIT(); GDS_DSQL_SQL_INFO(status_vector, &statement->rsr_handle, stuff->p_info_items.cstr_length, @@ -2603,7 +2603,7 @@ ISC_STATUS rem_port::info(P_OP op, P_INFO * stuff, PACKET* sendL) const char*>(stuff->p_info_items.cstr_address), stuff->p_info_buffer_length, reinterpret_cast < char *>(buffer)); - THREAD_ENTER; + THREAD_ENTER(); break; } @@ -2663,14 +2663,14 @@ ISC_STATUS rem_port::insert(P_SQLDATA * sqldata, PACKET* sendL) msg = NULL; } - THREAD_EXIT; + THREAD_EXIT(); GDS_DSQL_INSERT(status_vector, &statement->rsr_handle, sqldata->p_sqldata_blr.cstr_length, reinterpret_cast(sqldata->p_sqldata_blr.cstr_address), sqldata->p_sqldata_message_number, msg_length, reinterpret_cast(msg)); - THREAD_ENTER; + THREAD_ENTER(); return this->send_response(sendL, 0, 0, status_vector); } @@ -2736,7 +2736,7 @@ ISC_STATUS rem_port::open_blob(P_OP op, P_BLOB* stuff, PACKET* sendL) bpb = stuff->p_blob_bpb.cstr_address; } - THREAD_EXIT; + THREAD_EXIT(); if (op == op_open_blob || op == op_open_blob2) isc_open_blob2(status_vector, &rdb->rdb_handle, &transaction->rtr_handle, &handle, @@ -2745,7 +2745,7 @@ ISC_STATUS rem_port::open_blob(P_OP op, P_BLOB* stuff, PACKET* sendL) isc_create_blob2(status_vector, &rdb->rdb_handle, &transaction->rtr_handle, &handle, (ISC_QUAD*) &sendL->p_resp.p_resp_blob_id, bpb_length, reinterpret_cast(bpb)); - THREAD_ENTER; + THREAD_ENTER(); USHORT object; if (status_vector[1]) @@ -2769,9 +2769,9 @@ ISC_STATUS rem_port::open_blob(P_OP op, P_BLOB* stuff, PACKET* sendL) else { object = 0; - THREAD_EXIT; + THREAD_EXIT(); isc_cancel_blob(status_vector, &blob->rbl_handle); - THREAD_ENTER; + THREAD_ENTER(); ALLR_release(blob); status_vector[0] = isc_arg_gds; status_vector[1] = isc_too_many_handles; @@ -2804,14 +2804,14 @@ ISC_STATUS rem_port::prepare(P_PREP * stuff, PACKET* sendL) stuff->p_prep_transaction, isc_bad_trans_handle); - THREAD_EXIT; + THREAD_EXIT(); if (!isc_prepare_transaction2(status_vector, &transaction->rtr_handle, stuff->p_prep_data.cstr_length, stuff->p_prep_data.cstr_address)) { transaction->rtr_flags |= RTR_limbo; } - THREAD_ENTER; + THREAD_ENTER(); return this->send_response(sendL, 0, 0, status_vector); } @@ -2879,7 +2879,7 @@ ISC_STATUS rem_port::prepare_statement(P_SQLST * prepareL, PACKET* sendL) */ const USHORT parser_version = (this->port_protocol < PROTOCOL_VERSION10) ? 1 : 2; - THREAD_EXIT; + THREAD_EXIT(); GDS_DSQL_PREPARE(status_vector, &handle, &statement->rsr_handle, @@ -2891,7 +2891,7 @@ ISC_STATUS rem_port::prepare_statement(P_SQLST * prepareL, PACKET* sendL) reinterpret_cast(prepareL->p_sqlst_items.cstr_address), prepareL->p_sqlst_buffer_length, reinterpret_cast(buffer)); - THREAD_ENTER; + THREAD_ENTER(); if (status_vector[1]) { if (buffer != local_buffer) @@ -3251,10 +3251,10 @@ ISC_STATUS rem_port::put_segment(P_OP op, P_SGMT * segment, PACKET* sendL) bad news. */ if (op == op_put_segment) { - THREAD_EXIT; + THREAD_EXIT(); isc_put_segment(status_vector, &blob->rbl_handle, length, reinterpret_cast(p)); - THREAD_ENTER; + THREAD_ENTER(); return this->send_response(sendL, 0, 0, status_vector); } @@ -3265,10 +3265,10 @@ ISC_STATUS rem_port::put_segment(P_OP op, P_SGMT * segment, PACKET* sendL) while (p < end) { length = *p++; length += *p++ << 8; - THREAD_EXIT; + THREAD_EXIT(); isc_put_segment(status_vector, &blob->rbl_handle, length, reinterpret_cast(p)); - THREAD_ENTER; + THREAD_ENTER(); if (status_vector[1]) return this->send_response(sendL, 0, 0, status_vector); p += length; @@ -3301,7 +3301,7 @@ ISC_STATUS rem_port::put_slice(P_SLC * stuff, PACKET* sendL) RDB rdb = this->port_context; - THREAD_EXIT; + THREAD_EXIT(); sendL->p_resp.p_resp_blob_id = stuff->p_slc_id; isc_put_slice(status_vector, &rdb->rdb_handle, &transaction->rtr_handle, (ISC_QUAD*) &sendL->p_resp.p_resp_blob_id, @@ -3311,7 +3311,7 @@ ISC_STATUS rem_port::put_slice(P_SLC * stuff, PACKET* sendL) (ISC_LONG *) stuff->p_slc_parameters.cstr_address, stuff->p_slc_slice.lstr_length, stuff->p_slc_slice.lstr_address); - THREAD_ENTER; + THREAD_ENTER(); return this->send_response(sendL, 0, 0, status_vector); } @@ -3362,14 +3362,14 @@ ISC_STATUS rem_port::que_events(P_EVENT * stuff, PACKET* sendL) event->rvnt_rid = stuff->p_event_rid; event->rvnt_rdb = rdb; - THREAD_EXIT; + THREAD_EXIT(); ISC_STATUS_ARRAY status_vector; isc_que_events(status_vector, &rdb->rdb_handle, &event->rvnt_id, stuff->p_event_items.cstr_length, reinterpret_cast(stuff->p_event_items.cstr_address), server_ast, event); - THREAD_ENTER; + THREAD_ENTER(); const SLONG id = event->rvnt_id; if (status_vector[1]) { @@ -3533,7 +3533,7 @@ ISC_STATUS rem_port::receive_msg(P_DATA * data, PACKET* sendL) return res; } - THREAD_EXIT; + THREAD_EXIT(); #ifdef SCROLLABLE_CURSORS isc_receive2(status_vector, &requestL->rrq_handle, msg_number, format->fmt_length, message->msg_buffer, level, @@ -3542,7 +3542,7 @@ ISC_STATUS rem_port::receive_msg(P_DATA * data, PACKET* sendL) isc_receive(status_vector, &requestL->rrq_handle, msg_number, format->fmt_length, message->msg_buffer, level); #endif - THREAD_ENTER; + THREAD_ENTER(); if (status_vector[1]) return this->send_response(sendL, 0, 0, status_vector); @@ -3670,11 +3670,11 @@ ISC_STATUS rem_port::receive_msg(P_DATA * data, PACKET* sendL) just doing a simple lookahead continuing on in the last direction specified, so there is no reason to do an isc_receive2() */ - THREAD_EXIT; + THREAD_EXIT(); isc_receive(status_vector, &requestL->rrq_handle, msg_number, format->fmt_length, message->msg_buffer, data->p_data_incarnation); - THREAD_ENTER; + THREAD_ENTER(); /* Did we have an error? If so, save it for later delivery */ @@ -4018,10 +4018,10 @@ ISC_STATUS rem_port::seek_blob(P_SEEK * seek, PACKET* sendL) const SSHORT mode = seek->p_seek_mode; const SLONG offset = seek->p_seek_offset; - THREAD_EXIT; + THREAD_EXIT(); SLONG result; isc_seek_blob(status_vector, &blob->rbl_handle, mode, offset, &result); - THREAD_ENTER; + THREAD_ENTER(); sendL->p_resp.p_resp_blob_id.bid_number = result; @@ -4055,10 +4055,10 @@ ISC_STATUS rem_port::send_msg(P_DATA * data, PACKET* sendL) REM_MSG message = requestL->rrq_rpt[number].rrq_message; const rem_fmt* format = requestL->rrq_rpt[number].rrq_format; - THREAD_EXIT; + THREAD_EXIT(); isc_send(status_vector, &requestL->rrq_handle, number, format->fmt_length, message->msg_address, data->p_data_incarnation); - THREAD_ENTER; + THREAD_ENTER(); message->msg_address = NULL; @@ -4204,13 +4204,13 @@ static void server_ast(void* event_void, USHORT length, const UCHAR* items) **************************************/ RVNT event = static_cast(event_void); - THREAD_ENTER; + THREAD_ENTER(); event->rvnt_id = 0; RDB rdb = event->rvnt_rdb; rem_port* port = rdb->rdb_port->port_async; if (!port) { - THREAD_EXIT; + THREAD_EXIT(); return; } @@ -4230,7 +4230,7 @@ static void server_ast(void* event_void, USHORT length, const UCHAR* items) p_event->p_event_rid = event->rvnt_rid; port->send(&packet); - THREAD_EXIT; + THREAD_EXIT(); } @@ -4290,7 +4290,7 @@ ISC_STATUS rem_port::service_attach(P_ATCH* attach, PACKET* sendL) they will be stuffed in the SPB if so. */ REMOTE_get_timeout_params(this, spb, spb_length); - THREAD_EXIT; + THREAD_EXIT(); ISC_STATUS_ARRAY status_vector; isc_service_attach(status_vector, service_length, @@ -4298,7 +4298,7 @@ ISC_STATUS rem_port::service_attach(P_ATCH* attach, PACKET* sendL) &handle, spb_length, reinterpret_cast(spb)); - THREAD_ENTER; + THREAD_ENTER(); if (new_spb != new_spb_buffer) ALLR_free(new_spb); @@ -4334,9 +4334,9 @@ ISC_STATUS rem_port::service_end(P_RLSE * release, PACKET* sendL) ISC_STATUS_ARRAY status_vector; - THREAD_EXIT; + THREAD_EXIT(); isc_service_detach(status_vector, &rdb->rdb_handle); - THREAD_ENTER; + THREAD_ENTER(); return this->send_response(sendL, 0, 0, status_vector); } @@ -4358,14 +4358,14 @@ ISC_STATUS rem_port::service_start(P_INFO * stuff, PACKET* sendL) ISC_STATUS_ARRAY status_vector; - THREAD_EXIT; + THREAD_EXIT(); SLONG* reserved = 0; // reserved for future use isc_service_start(status_vector, &rdb->rdb_handle, reserved, stuff->p_info_items.cstr_length, reinterpret_cast(stuff->p_info_items.cstr_address)); - THREAD_ENTER; + THREAD_ENTER(); return this->send_response(sendL, 0, 0, status_vector); } @@ -4392,12 +4392,12 @@ ISC_STATUS rem_port::set_cursor(P_SQLCUR * sqlcur, PACKET* sendL) sqlcur->p_sqlcur_statement, isc_bad_req_handle); - THREAD_EXIT; + THREAD_EXIT(); GDS_DSQL_SET_CURSOR(status_vector, &statement->rsr_handle, reinterpret_cast(sqlcur->p_sqlcur_cursor_name.cstr_address), sqlcur->p_sqlcur_type); - THREAD_ENTER; + THREAD_ENTER(); return this->send_response(sendL, 0, 0, status_vector); } @@ -4468,10 +4468,10 @@ ISC_STATUS rem_port::start(P_OP operation, P_DATA * data, PACKET* sendL) requestL = REMOTE_find_request(requestL, data->p_data_incarnation); REMOTE_reset_request(requestL, 0); - THREAD_EXIT; + THREAD_EXIT(); isc_start_request(status_vector, &requestL->rrq_handle, &transaction->rtr_handle, data->p_data_incarnation); - THREAD_ENTER; + THREAD_ENTER(); if (!status_vector[1]) { requestL->rrq_rtr = transaction; @@ -4518,12 +4518,12 @@ ISC_STATUS rem_port::start_and_send(P_OP operation, REMOTE_reset_request(requestL, message); - THREAD_EXIT; + THREAD_EXIT(); isc_start_and_send(status_vector, &requestL->rrq_handle, &transaction->rtr_handle, number, format->fmt_length, message->msg_address, data->p_data_incarnation); - THREAD_ENTER; + THREAD_ENTER(); if (!status_vector[1]) { requestL->rrq_rtr = transaction; @@ -4553,7 +4553,7 @@ ISC_STATUS rem_port::start_transaction(P_OP operation, P_STTR * stuff, PACKET* s RDB rdb = this->port_context; FB_API_HANDLE handle = 0; - THREAD_EXIT; + THREAD_EXIT(); if (operation == op_reconnect) isc_reconnect_transaction(status_vector, &rdb->rdb_handle, &handle, stuff->p_sttr_tpb.cstr_length, @@ -4562,7 +4562,7 @@ ISC_STATUS rem_port::start_transaction(P_OP operation, P_STTR * stuff, PACKET* s isc_start_transaction(status_vector, &handle, (SSHORT) 1, &rdb->rdb_handle, stuff->p_sttr_tpb.cstr_length, stuff->p_sttr_tpb.cstr_address); - THREAD_ENTER; + THREAD_ENTER(); OBJCT object; if (status_vector[1]) @@ -4584,7 +4584,7 @@ ISC_STATUS rem_port::start_transaction(P_OP operation, P_STTR * stuff, PACKET* s } else { object = 0; - THREAD_EXIT; + THREAD_EXIT(); if (operation != op_reconnect) isc_rollback_transaction(status_vector, &handle); #ifdef SUPERSERVER @@ -4600,7 +4600,7 @@ ISC_STATUS rem_port::start_transaction(P_OP operation, P_STTR * stuff, PACKET* s gds__handle_cleanup(status_vector, &handle); } #endif - THREAD_ENTER; + THREAD_ENTER(); status_vector[0] = isc_arg_gds; status_vector[1] = isc_too_many_handles; status_vector[2] = isc_arg_end; @@ -4653,7 +4653,7 @@ static int THREAD_ROUTINE loopThread(void* flags) USHORT inactive_count = 0; USHORT timedout_count = 0; - THREAD_ENTER; + THREAD_ENTER(); rem_port* port; @@ -4675,9 +4675,9 @@ static int THREAD_ROUTINE loopThread(void* flags) port = request->req_port; request->req_next = free_requests; free_requests = request; - THREAD_EXIT; + THREAD_EXIT(); SRVR_main(port, port->port_server_flags); - THREAD_ENTER; + THREAD_ENTER(); request = 0; continue; } @@ -4778,7 +4778,7 @@ static int THREAD_ROUTINE loopThread(void* flags) } threads_waiting++; - THREAD_EXIT; + THREAD_EXIT(); /* Wait for 1 minute (60 seconds) on a new request */ REMOTE_TRACE(("Wait for event")); if (!requests_semaphore.tryEnter(60)) { @@ -4788,12 +4788,12 @@ static int THREAD_ROUTINE loopThread(void* flags) else { REMOTE_TRACE(("got it")); } - THREAD_ENTER; + THREAD_ENTER(); --threads_waiting; } } - THREAD_EXIT; + THREAD_EXIT(); #ifdef WIN_NT if (!((SLONG) flags & SRVR_non_service)) @@ -4839,7 +4839,7 @@ ISC_STATUS rem_port::transact_request(P_TRRQ* trrq, PACKET* sendL) (procedure->rpr_out_format) ? procedure->rpr_out_format-> fmt_length : 0; - THREAD_EXIT; + THREAD_EXIT(); isc_transact_request(status_vector, &rdb->rdb_handle, &transaction->rtr_handle, @@ -4849,7 +4849,7 @@ ISC_STATUS rem_port::transact_request(P_TRRQ* trrq, PACKET* sendL) reinterpret_cast(in_msg), out_msg_length, reinterpret_cast(out_msg)); - THREAD_ENTER; + THREAD_ENTER(); if (status_vector[1]) return this->send_response(sendL, 0, 0, status_vector); diff --git a/src/remote/xnet.cpp b/src/remote/xnet.cpp index fe3ea28fa1..c1c0f8e53d 100644 --- a/src/remote/xnet.cpp +++ b/src/remote/xnet.cpp @@ -143,10 +143,10 @@ static MUTX_T xnet_mutex; #elif defined(SUPERSERVER) #define XNET_LOCK if (!xnet_shutdown) \ - THREAD_EXIT; \ + THREAD_EXIT(); \ THD_mutex_lock(&xnet_mutex); \ if (!xnet_shutdown) \ - THREAD_ENTER; + THREAD_ENTER(); #define XNET_UNLOCK THD_mutex_unlock(&xnet_mutex) @@ -1714,12 +1714,12 @@ static bool_t xnet_getbytes(XDR * xdrs, SCHAR * buff, u_int count) xdrs->x_private += to_copy; } else { - THREAD_EXIT; + THREAD_EXIT(); if (!xnet_read(xdrs)) { - THREAD_ENTER; + THREAD_ENTER(); return FALSE; }; - THREAD_ENTER; + THREAD_ENTER(); } if (to_copy) { @@ -1832,7 +1832,7 @@ static bool_t xnet_putbytes(XDR* xdrs, const SCHAR* buff, u_int count) if ((ULONG) xdrs->x_handy == xch->xch_size) { - THREAD_EXIT; + THREAD_EXIT(); while (!xnet_shutdown) { const DWORD wait_result = @@ -1858,18 +1858,18 @@ static bool_t xnet_putbytes(XDR* xdrs, const SCHAR* buff, u_int count) isc_conn_lost, 0); #endif - THREAD_ENTER; + THREAD_ENTER(); return FALSE; } } else { XNET_ERROR(port, "WaitForSingleObject()", isc_net_write_err, ERRNO); - THREAD_ENTER; + THREAD_ENTER(); return FALSE; /* a non-timeout result is an error */ } } - THREAD_ENTER; + THREAD_ENTER(); } if (to_copy == sizeof(SLONG)) @@ -2210,7 +2210,7 @@ static bool_t xnet_fork(ULONG client_pid, USHORT flag, ULONG* forken_pid) DWORD config_len; config = (LPQUERY_SERVICE_CONFIG) buffer; - THREAD_EXIT; + THREAD_EXIT(); if (!QueryServiceConfig(service, config, sizeof(buffer), &config_len)) { config = (LPQUERY_SERVICE_CONFIG) ALLR_alloc(config_len); @@ -2223,7 +2223,7 @@ static bool_t xnet_fork(ULONG client_pid, USHORT flag, ULONG* forken_pid) ALLR_free(config); } CloseServiceHandle(service); - THREAD_ENTER; + THREAD_ENTER(); } else { strcpy(XNET_command_line, GetCommandLine()); @@ -2546,9 +2546,9 @@ void XNET_srv(USHORT flag) // mark connect area as untouched // presponse->proc_id = CurrentProcessId; - THREAD_EXIT; + THREAD_EXIT(); const DWORD wait_res = WaitForSingleObject(xnet_connect_event, INFINITE); - THREAD_ENTER; + THREAD_ENTER(); if (wait_res != WAIT_OBJECT_0) { XNET_LOG_ERRORC("WaitForSingleObject() failed");