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

Macro cleaning (THREAD_*)

This commit is contained in:
brodsom 2004-05-15 00:58:46 +00:00
parent cd13f2dcfc
commit ee34db7e20
40 changed files with 698 additions and 665 deletions

View File

@ -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" // 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
// conditionals, as the engine now fully supports // conditionals, as the engine now fully supports
@ -42,14 +42,14 @@
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include "../jrd/ibase.h"
#include "../jrd/common.h"
#include "../jrd/license.h"
#include "../alice/alice.h" #include "../alice/alice.h"
#include "../alice/aliceswi.h" #include "../alice/aliceswi.h"
#include "../alice/all.h" #include "../alice/all.h"
#include "../alice/all_proto.h" #include "../alice/all_proto.h"
#include "../alice/exe_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/msg_encode.h"
#include "../jrd/gds_proto.h" #include "../jrd/gds_proto.h"
#include "../jrd/svc.h" #include "../jrd/svc.h"

View File

@ -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 "firebird.h"
#include "../jrd/common.h"
#include "../alice/all.h" #include "../alice/all.h"
#include "../alice/alice.h" #include "../alice/alice.h"
#include "../jrd/thd_proto.h" #include "../jrd/thd_proto.h"

View File

@ -27,27 +27,27 @@ V4 Multi-threading changes.
-- direct calls to gds__ () & isc_ () entry points -- direct calls to gds__ () & isc_ () entry points
THREAD_EXIT; THREAD_EXIT();
gds__ () or isc_ () call. gds__ () or isc_ () call.
THREAD_ENTER; THREAD_ENTER();
-- calls through embedded GDML. -- calls through embedded GDML.
the following protocol will be used. Care should be taken if the following protocol will be used. Care should be taken if
nested FOR loops are added. nested FOR loops are added.
THREAD_EXIT; // last statment before FOR loop THREAD_EXIT(); // last statment before FOR loop
FOR ............... FOR ...............
THREAD_ENTER; // First statment in FOR loop THREAD_ENTER(); // First statment in FOR loop
.....some C code.... .....some C code....
.....some C code.... .....some C code....
THREAD_EXIT; // last statment in FOR loop THREAD_EXIT(); // last statment in FOR loop
END_FOR; END_FOR;
THREAD_ENTER; // First statment after FOR loop THREAD_ENTER(); // First statment after FOR loop
***************************************************************/ ***************************************************************/
#include "firebird.h" #include "firebird.h"

View File

@ -20,7 +20,7 @@
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * 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, * 2001.5.20 Claudio Valderrama: Stop null pointer that leads to a crash,
* caused by incomplete yacc syntax that allows ALTER DOMAIN dom SET; * 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(); const USHORT length = request->req_blr_data.getCount();
THREAD_EXIT; THREAD_EXIT();
const ISC_STATUS s = const ISC_STATUS s =
isc_ddl(tdsql->tsql_status, &request->req_dbb->dbb_database_handle, isc_ddl(tdsql->tsql_status, &request->req_dbb->dbb_database_handle,
&request->req_trans, length, &request->req_trans, length,
(const char*)(request->req_blr_data.begin())); (const char*)(request->req_blr_data.begin()));
THREAD_ENTER; THREAD_ENTER();
// for delete & modify, get rid of the cached relation metadata // for delete & modify, get rid of the cached relation metadata

View File

@ -37,27 +37,27 @@ V4 Multi-threading changes.
-- direct calls to gds__ () & isc_ () entrypoints -- direct calls to gds__ () & isc_ () entrypoints
THREAD_EXIT; THREAD_EXIT();
gds__ () or isc_ () call. gds__ () or isc_ () call.
THREAD_ENTER; THREAD_ENTER();
-- calls through embedded GDML. -- calls through embedded GDML.
the following protocol will be used. Care should be taken if the following protocol will be used. Care should be taken if
nested FOR loops are added. nested FOR loops are added.
THREAD_EXIT; // last statement before FOR loop THREAD_EXIT(); // last statement before FOR loop
FOR ............... FOR ...............
THREAD_ENTER; // First statement in FOR loop THREAD_ENTER(); // First statement in FOR loop
.....some C code.... .....some C code....
.....some C code.... .....some C code....
THREAD_EXIT; // last statement in FOR loop THREAD_EXIT(); // last statement in FOR loop
END_FOR; END_FOR;
THREAD_ENTER; // First statement after FOR loop THREAD_ENTER(); // First statement after FOR loop
***************************************************************/ ***************************************************************/
#include "firebird.h" #include "firebird.h"
@ -599,12 +599,12 @@ ISC_STATUS GDS_DSQL_EXECUTE_CPP(
open_cursor->opn_next = open_cursors; open_cursor->opn_next = open_cursors;
open_cursors = open_cursor; open_cursors = open_cursor;
THD_MUTEX_UNLOCK(&cursors_mutex); THD_MUTEX_UNLOCK(&cursors_mutex);
THREAD_EXIT; THREAD_EXIT();
ISC_STATUS_ARRAY local_status; ISC_STATUS_ARRAY local_status;
gds__transaction_cleanup(local_status, gds__transaction_cleanup(local_status,
trans_handle, trans_handle,
cleanup_transaction, NULL); cleanup_transaction, NULL);
THREAD_ENTER; THREAD_ENTER();
} }
if (!sing_status) { 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 // 1. Locate why_db_handle, corresponding to jrd_database_handle
THREAD_EXIT; THREAD_EXIT();
THD_MUTEX_LOCK (&databases_mutex); THD_MUTEX_LOCK (&databases_mutex);
dsql_dbb* database; dsql_dbb* database;
for (database = databases; database; database = database->dbb_next) 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[1] = isc_bad_db_handle;
status[2] = isc_arg_end; status[2] = isc_arg_end;
THD_MUTEX_UNLOCK(&databases_mutex); THD_MUTEX_UNLOCK(&databases_mutex);
THREAD_ENTER; THREAD_ENTER();
return status[1]; return status[1];
} }
WHY_DBB why_db_handle = WHY_translate_handle(database->dbb_database_handle); 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[1] = isc_virmemexh;
status[2] = isc_arg_end; status[2] = isc_arg_end;
THD_MUTEX_UNLOCK(&databases_mutex); THD_MUTEX_UNLOCK(&databases_mutex);
THREAD_ENTER; THREAD_ENTER();
return status[1]; return status[1];
} }
why_trans_handle->handle.h_tra = jrd_transaction_handle; why_trans_handle->handle.h_tra = jrd_transaction_handle;
why_trans_handle->parent = why_db_handle; why_trans_handle->parent = why_db_handle;
THD_MUTEX_UNLOCK (&databases_mutex); THD_MUTEX_UNLOCK (&databases_mutex);
THREAD_ENTER; THREAD_ENTER();
// 3. Call execute... function // 3. Call execute... function
const ISC_STATUS rc = dsql8_execute_immediate_common(status, 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, WHY_DBB GetWhyAttachment (ISC_STATUS* status,
Jrd::Attachment* jrd_attachment_handle) Jrd::Attachment* jrd_attachment_handle)
{ {
THREAD_EXIT; THREAD_EXIT();
THD_MUTEX_LOCK (&databases_mutex); THD_MUTEX_LOCK (&databases_mutex);
dsql_dbb* database; dsql_dbb* database;
WHY_DBB db_handle; WHY_DBB db_handle;
@ -921,7 +921,7 @@ WHY_DBB GetWhyAttachment (ISC_STATUS* status,
status[2] = isc_arg_end; status[2] = isc_arg_end;
} }
THD_MUTEX_UNLOCK (&databases_mutex); THD_MUTEX_UNLOCK (&databases_mutex);
THREAD_ENTER; THREAD_ENTER();
return database ? db_handle : 0; 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); MOVD_move(&desc, &offset_parameter->par_desc);
THREAD_EXIT; THREAD_EXIT();
s = isc_receive2(tdsql->tsql_status, &request->req_handle, s = isc_receive2(tdsql->tsql_status, &request->req_handle,
message->msg_number, message->msg_length, message->msg_number, message->msg_length,
message->msg_buffer, 0, direction, offset); message->msg_buffer, 0, direction, offset);
THREAD_ENTER; THREAD_ENTER();
if (s) { if (s) {
punt(); punt();
@ -1109,11 +1109,11 @@ ISC_STATUS GDS_DSQL_FETCH_CPP( ISC_STATUS* user_status,
USHORT* ret_length = USHORT* ret_length =
(USHORT *) (dsql_msg_buf + (IPTR) null->par_user_desc.dsc_address); (USHORT *) (dsql_msg_buf + (IPTR) null->par_user_desc.dsc_address);
UCHAR* buffer = dsql_msg_buf + (IPTR) parameter->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, s = isc_get_segment(tdsql->tsql_status, &request->req_handle,
ret_length, parameter->par_user_desc.dsc_length, ret_length, parameter->par_user_desc.dsc_length,
reinterpret_cast<char*>(buffer)); reinterpret_cast<char*>(buffer));
THREAD_ENTER; THREAD_ENTER();
if (!s) { if (!s) {
RESTORE_THREAD_DATA; RESTORE_THREAD_DATA;
return 0; return 0;
@ -1130,11 +1130,11 @@ ISC_STATUS GDS_DSQL_FETCH_CPP( ISC_STATUS* user_status,
punt(); punt();
} }
THREAD_EXIT; THREAD_EXIT();
s = isc_receive(tdsql->tsql_status, &request->req_handle, s = isc_receive(tdsql->tsql_status, &request->req_handle,
message->msg_number, message->msg_length, message->msg_number, message->msg_length,
message->msg_buffer, 0); message->msg_buffer, 0);
THREAD_ENTER; THREAD_ENTER();
if (s) { if (s) {
punt(); punt();
@ -1282,11 +1282,11 @@ ISC_STATUS GDS_DSQL_INSERT_CPP( ISC_STATUS* user_status,
const SCHAR* buffer = const SCHAR* buffer =
reinterpret_cast<const SCHAR*>( reinterpret_cast<const SCHAR*>(
dsql_msg_buf + (IPTR) parameter->par_user_desc.dsc_address); dsql_msg_buf + (IPTR) parameter->par_user_desc.dsc_address);
THREAD_EXIT; THREAD_EXIT();
const ISC_STATUS s = const ISC_STATUS s =
isc_put_segment(tdsql->tsql_status, &request->req_handle, isc_put_segment(tdsql->tsql_status, &request->req_handle,
parameter->par_user_desc.dsc_length, buffer); parameter->par_user_desc.dsc_length, buffer);
THREAD_ENTER; THREAD_ENTER();
if (s) if (s)
punt(); punt();
} }
@ -2855,7 +2855,7 @@ static void cleanup_database(FB_API_HANDLE* db_handle, void* flag)
return; return;
/* if (flag) /* if (flag)
THREAD_EXIT;*/ THREAD_EXIT();*/
THD_MUTEX_LOCK(&databases_mutex); 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]) if (dbb->dbb_requests[i])
isc_release_request(user_status, isc_release_request(user_status,
reinterpret_cast <void**>(&dbb->dbb_requests[i])); reinterpret_cast <void**>(&dbb->dbb_requests[i]));
THREAD_ENTER; THREAD_ENTER();
} }
HSHD_finish(dbb); HSHD_finish(dbb);
delete dbb->dbb_pool; delete dbb->dbb_pool;
} }
else if (flag) else if (flag)
THREAD_ENTER; THREAD_ENTER();
*/ */
if (dbb) { if (dbb) {
HSHD_finish(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() * 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 * call in why.c below the cleanup handlers. smistry 9-27-98
*/ */
THREAD_ENTER; //ttt THREAD_ENTER(); //ttt
GDS_DSQL_FREE_CPP( local_status, GDS_DSQL_FREE_CPP( local_status,
&open_cursor->opn_request, &open_cursor->opn_request,
DSQL_close); DSQL_close);
THREAD_EXIT; THREAD_EXIT();
THD_MUTEX_LOCK(&cursors_mutex); THD_MUTEX_LOCK(&cursors_mutex);
open_cursor_ptr = &open_cursors; open_cursor_ptr = &open_cursors;
} }
@ -2960,13 +2960,13 @@ static void close_cursor( dsql_req* request)
ISC_STATUS_ARRAY status_vector; ISC_STATUS_ARRAY status_vector;
if (request->req_handle) { if (request->req_handle) {
THREAD_EXIT; //ttt THREAD_EXIT(); //ttt
if (request->req_type == REQ_GET_SEGMENT || if (request->req_type == REQ_GET_SEGMENT ||
request->req_type == REQ_PUT_SEGMENT) request->req_type == REQ_PUT_SEGMENT)
isc_close_blob(status_vector, &request->req_handle); isc_close_blob(status_vector, &request->req_handle);
else else
isc_unwind_request(status_vector, &request->req_handle, 0); isc_unwind_request(status_vector, &request->req_handle, 0);
THREAD_ENTER; THREAD_ENTER();
} }
request->req_flags &= ~(REQ_cursor_open | REQ_embedded_sql_cursor); 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) { if (null && *((SSHORT *) null->par_desc.dsc_address) < 0) {
memset(blob_id, 0, sizeof(ISC_QUAD)); memset(blob_id, 0, sizeof(ISC_QUAD));
} }
THREAD_EXIT; THREAD_EXIT();
s = isc_open_blob2(tdsql->tsql_status, s = isc_open_blob2(tdsql->tsql_status,
&request->req_dbb->dbb_database_handle, &request->req_dbb->dbb_database_handle,
&request->req_trans, &request->req_handle, &request->req_trans, &request->req_handle,
blob_id, bpb_length, blob_id, bpb_length,
bpb); bpb);
THREAD_ENTER; THREAD_ENTER();
if (s) { if (s) {
punt(); punt();
} }
@ -3134,13 +3134,13 @@ static void execute_blob( dsql_req* request,
request->req_handle = 0; request->req_handle = 0;
ISC_QUAD* blob_id = (ISC_QUAD*) parameter->par_desc.dsc_address; ISC_QUAD* blob_id = (ISC_QUAD*) parameter->par_desc.dsc_address;
memset(blob_id, 0, sizeof(ISC_QUAD)); memset(blob_id, 0, sizeof(ISC_QUAD));
THREAD_EXIT; THREAD_EXIT();
s = isc_create_blob2(tdsql->tsql_status, s = isc_create_blob2(tdsql->tsql_status,
&request->req_dbb->dbb_database_handle, &request->req_dbb->dbb_database_handle,
&request->req_trans, &request->req_handle, &request->req_trans, &request->req_handle,
blob_id, bpb_length, blob_id, bpb_length,
reinterpret_cast<const char*>(bpb)); reinterpret_cast<const char*>(bpb));
THREAD_ENTER; THREAD_ENTER();
if (s) { if (s) {
punt(); punt();
} }
@ -3196,43 +3196,43 @@ static ISC_STATUS execute_request(dsql_req* request,
switch (request->req_type) { switch (request->req_type) {
case REQ_START_TRANS: case REQ_START_TRANS:
THREAD_EXIT; THREAD_EXIT();
s = isc_start_transaction( tdsql->tsql_status, s = isc_start_transaction( tdsql->tsql_status,
&request->req_trans, &request->req_trans,
1, 1,
&request->req_dbb->dbb_database_handle, &request->req_dbb->dbb_database_handle,
request->req_blr_data.getCount(), request->req_blr_data.getCount(),
request->req_blr_data.begin()); request->req_blr_data.begin());
THREAD_ENTER; THREAD_ENTER();
if (s) if (s)
punt(); punt();
*trans_handle = request->req_trans; *trans_handle = request->req_trans;
return FB_SUCCESS; return FB_SUCCESS;
case REQ_COMMIT: case REQ_COMMIT:
THREAD_EXIT; THREAD_EXIT();
s = isc_commit_transaction(tdsql->tsql_status, s = isc_commit_transaction(tdsql->tsql_status,
&request->req_trans); &request->req_trans);
THREAD_ENTER; THREAD_ENTER();
if (s) if (s)
punt(); punt();
*trans_handle = 0; *trans_handle = 0;
return FB_SUCCESS; return FB_SUCCESS;
case REQ_COMMIT_RETAIN: case REQ_COMMIT_RETAIN:
THREAD_EXIT; THREAD_EXIT();
s = isc_commit_retaining(tdsql->tsql_status, s = isc_commit_retaining(tdsql->tsql_status,
&request->req_trans); &request->req_trans);
THREAD_ENTER; THREAD_ENTER();
if (s) if (s)
punt(); punt();
return FB_SUCCESS; return FB_SUCCESS;
case REQ_ROLLBACK: case REQ_ROLLBACK:
THREAD_EXIT; THREAD_EXIT();
s = isc_rollback_transaction(tdsql->tsql_status, s = isc_rollback_transaction(tdsql->tsql_status,
&request->req_trans); &request->req_trans);
THREAD_ENTER; THREAD_ENTER();
if (s) if (s)
punt(); punt();
*trans_handle = 0; *trans_handle = 0;
@ -3289,7 +3289,7 @@ static ISC_STATUS execute_request(dsql_req* request,
use_msg_length = 0; use_msg_length = 0;
use_msg = NULL; use_msg = NULL;
} }
THREAD_EXIT; THREAD_EXIT();
s = isc_transact_request(tdsql->tsql_status, s = isc_transact_request(tdsql->tsql_status,
&request->req_dbb->dbb_database_handle, &request->req_dbb->dbb_database_handle,
&request->req_trans, &request->req_trans,
@ -3299,7 +3299,7 @@ static ISC_STATUS execute_request(dsql_req* request,
reinterpret_cast<char*>(in_msg), reinterpret_cast<char*>(in_msg),
use_msg_length, use_msg_length,
reinterpret_cast<char*>(use_msg)); reinterpret_cast<char*>(use_msg));
THREAD_ENTER; THREAD_ENTER();
if (s) if (s)
punt(); punt();
@ -3332,12 +3332,12 @@ static ISC_STATUS execute_request(dsql_req* request,
message = (dsql_msg*) request->req_send; message = (dsql_msg*) request->req_send;
if (!message) if (!message)
{ {
THREAD_EXIT; THREAD_EXIT();
s = isc_start_request(tdsql->tsql_status, s = isc_start_request(tdsql->tsql_status,
&request->req_handle, &request->req_handle,
&request->req_trans, &request->req_trans,
0); 0);
THREAD_ENTER; THREAD_ENTER();
if (s) if (s)
punt(); punt();
} }
@ -3350,7 +3350,7 @@ static ISC_STATUS execute_request(dsql_req* request,
in_msg_length, in_msg_length,
in_msg); in_msg);
THREAD_EXIT; THREAD_EXIT();
s = isc_start_and_send(tdsql->tsql_status, s = isc_start_and_send(tdsql->tsql_status,
&request->req_handle, &request->req_handle,
&request->req_trans, &request->req_trans,
@ -3358,7 +3358,7 @@ static ISC_STATUS execute_request(dsql_req* request,
message->msg_length, message->msg_length,
message->msg_buffer, message->msg_buffer,
0); 0);
THREAD_ENTER; THREAD_ENTER();
if (s) if (s)
{ {
punt(); 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); message->msg_buffer = (UCHAR*)FB_ALIGN((U_IPTR) temp_buffer, DOUBLE_ALIGN);
} }
THREAD_EXIT; THREAD_EXIT();
s = isc_receive(tdsql->tsql_status, s = isc_receive(tdsql->tsql_status,
&request->req_handle, &request->req_handle,
message->msg_number, message->msg_number,
message->msg_length, message->msg_length,
message->msg_buffer, message->msg_buffer,
0); 0);
THREAD_ENTER; THREAD_ENTER();
if (s) { if (s) {
punt(); punt();
} }
@ -3419,7 +3419,7 @@ static ISC_STATUS execute_request(dsql_req* request,
(UCHAR*)gds__alloc((ULONG) message->msg_length); (UCHAR*)gds__alloc((ULONG) message->msg_length);
s = 0; s = 0;
THREAD_EXIT; THREAD_EXIT();
for (counter = 0; counter < 2 && !s; counter++) for (counter = 0; counter < 2 && !s; counter++)
{ {
s = isc_receive(local_status, s = isc_receive(local_status,
@ -3429,7 +3429,7 @@ static ISC_STATUS execute_request(dsql_req* request,
message_buffer, message_buffer,
0); 0);
} }
THREAD_ENTER; THREAD_ENTER();
gds__free(message_buffer); gds__free(message_buffer);
/* two successful receives means more than one record /* 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 // get the access path info for the underlying request from the engine
THREAD_EXIT; THREAD_EXIT();
s = isc_request_info(tdsql->tsql_status, s = isc_request_info(tdsql->tsql_status,
&request->req_handle, &request->req_handle,
0, 0,
sizeof(explain_info), sizeof(explain_info),
explain_info, explain_info,
sizeof(explain_buffer), explain_buffer); sizeof(explain_buffer), explain_buffer);
THREAD_ENTER; THREAD_ENTER();
if (s) if (s)
return 0; return 0;
@ -3649,13 +3649,13 @@ static USHORT get_plan_info(
return 0; return 0;
} }
THREAD_EXIT; THREAD_EXIT();
s = isc_request_info(tdsql->tsql_status, s = isc_request_info(tdsql->tsql_status,
&request->req_handle, 0, &request->req_handle, 0,
sizeof(explain_info), sizeof(explain_info),
explain_info, explain_info,
BUFFER_XLARGE, explain_ptr); BUFFER_XLARGE, explain_ptr);
THREAD_ENTER; THREAD_ENTER();
if (s) { if (s) {
// CVC: Before returning, deallocate the buffer! // CVC: Before returning, deallocate the buffer!
@ -3742,14 +3742,14 @@ static USHORT get_request_info(
// get the info for the request from the engine // get the info for the request from the engine
THREAD_EXIT; THREAD_EXIT();
s = isc_request_info(tdsql->tsql_status, s = isc_request_info(tdsql->tsql_status,
&request->req_handle, &request->req_handle,
0, 0,
sizeof(record_info), sizeof(record_info),
record_info, record_info,
buffer_length, buffer); buffer_length, buffer);
THREAD_ENTER; THREAD_ENTER();
if (s) if (s)
return 0; return 0;
@ -4144,9 +4144,9 @@ static dsql_dbb* init(FB_API_HANDLE* db_handle)
} }
#endif #endif
THREAD_EXIT; THREAD_EXIT();
THD_MUTEX_LOCK(&databases_mutex); THD_MUTEX_LOCK(&databases_mutex);
THREAD_ENTER; THREAD_ENTER();
if (!init_flag) if (!init_flag)
{ {
@ -4189,22 +4189,22 @@ static dsql_dbb* init(FB_API_HANDLE* db_handle)
ISC_STATUS_ARRAY user_status; ISC_STATUS_ARRAY user_status;
THREAD_EXIT; THREAD_EXIT();
isc_database_cleanup(user_status, db_handle, cleanup_database, NULL); isc_database_cleanup(user_status, db_handle, cleanup_database, NULL);
THREAD_ENTER; THREAD_ENTER();
// Determine if the database is V3 or V4 // Determine if the database is V3 or V4
SCHAR buffer[128]; SCHAR buffer[128];
database->dbb_flags |= DBB_v3; database->dbb_flags |= DBB_v3;
THREAD_EXIT; THREAD_EXIT();
const ISC_STATUS s = const ISC_STATUS s =
isc_database_info(user_status, db_handle, isc_database_info(user_status, db_handle,
sizeof(db_hdr_info_items), sizeof(db_hdr_info_items),
db_hdr_info_items, db_hdr_info_items,
sizeof(buffer), buffer); sizeof(buffer), buffer);
THREAD_ENTER; THREAD_ENTER();
if (s) { if (s) {
return database; return database;
@ -4801,12 +4801,12 @@ static dsql_req* prepare(
sizeof(ISC_STATUS) * ISC_STATUS_LENGTH); sizeof(ISC_STATUS) * ISC_STATUS_LENGTH);
} }
THREAD_EXIT; THREAD_EXIT();
const ISC_STATUS status = isc_compile_request(tdsql->tsql_status, const ISC_STATUS status = isc_compile_request(tdsql->tsql_status,
&request->req_dbb->dbb_database_handle, &request->req_dbb->dbb_database_handle,
&request->req_handle, length, &request->req_handle, length,
(const char*)(request->req_blr_data.begin())); (const char*)(request->req_blr_data.begin()));
THREAD_ENTER; THREAD_ENTER();
// restore warnings (if there are any) // restore warnings (if there are any)
if (local_status[2] == isc_arg_warning) 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 a request has been compiled, release it now
if (request->req_handle) { if (request->req_handle) {
THREAD_EXIT; THREAD_EXIT();
isc_release_request(status_vector, &request->req_handle); isc_release_request(status_vector, &request->req_handle);
THREAD_ENTER; THREAD_ENTER();
} }
// free blr memory // free blr memory

View File

@ -59,27 +59,27 @@ V4 Multi-threading changes.
-- direct calls to gds__ () & isc_ () entrypoints -- direct calls to gds__ () & isc_ () entrypoints
THREAD_EXIT; THREAD_EXIT();
gds__ () or isc_ () call. gds__ () or isc_ () call.
THREAD_ENTER; THREAD_ENTER();
-- calls through embedded GDML. -- calls through embedded GDML.
the following protocol will be used. Care should be taken if the following protocol will be used. Care should be taken if
nested FOR loops are added. nested FOR loops are added.
THREAD_EXIT; // last statment before FOR loop THREAD_EXIT(); // last statment before FOR loop
FOR ............... FOR ...............
THREAD_ENTER; // First statment in FOR loop THREAD_ENTER(); // First statment in FOR loop
.....some C code.... .....some C code....
.....some C code.... .....some C code....
THREAD_EXIT; // last statment in FOR loop THREAD_EXIT(); // last statment in FOR loop
END_FOR; END_FOR;
THREAD_ENTER; // First statment after FOR loop THREAD_ENTER(); // First statment after FOR loop
***************************************************************/ ***************************************************************/
DATABASE DB = STATIC "yachts.lnk"; DATABASE DB = STATIC "yachts.lnk";
@ -107,9 +107,9 @@ static inline void metd_rec_lock()
rec_mutex_inited = 1; rec_mutex_inited = 1;
THD_rec_mutex_init (&rec_mutex); THD_rec_mutex_init (&rec_mutex);
} }
THREAD_EXIT; THREAD_EXIT();
THD_rec_mutex_lock (&rec_mutex); THD_rec_mutex_lock (&rec_mutex);
THREAD_ENTER; THREAD_ENTER();
} }
static inline void metd_rec_unlock() 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; gds_trans = request->req_trans;
iname = NULL; iname = NULL;
THREAD_EXIT; THREAD_EXIT();
FOR(REQUEST_HANDLE dbb->dbb_requests[irq_collation]) FOR(REQUEST_HANDLE dbb->dbb_requests[irq_collation])
X IN RDB$COLLATIONS X IN RDB$COLLATIONS
CROSS Y IN RDB$CHARACTER_SETS OVER RDB$CHARACTER_SET_ID CROSS Y IN RDB$CHARACTER_SETS OVER RDB$CHARACTER_SET_ID
WITH X.RDB$COLLATION_NAME EQ name->str_data; 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; iname = FB_NEW_RPT(*dbb->dbb_pool, name->str_length) dsql_intlsym;
strcpy(iname->intlsym_name, (TEXT *) name->str_data); 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_collate_id);
iname->intlsym_bytes_per_char = iname->intlsym_bytes_per_char =
(Y.RDB$BYTES_PER_CHARACTER.NULL) ? 1 : (Y.RDB$BYTES_PER_CHARACTER); (Y.RDB$BYTES_PER_CHARACTER.NULL) ? 1 : (Y.RDB$BYTES_PER_CHARACTER);
THREAD_EXIT; THREAD_EXIT();
END_FOR ON_ERROR END_FOR ON_ERROR
// Assume V3 database // Assume V3 database
END_ERROR; END_ERROR;
THREAD_ENTER; THREAD_ENTER();
if (!iname) if (!iname)
return NULL; return NULL;
@ -393,7 +393,7 @@ USHORT METD_get_col_default(dsql_req* request,
gds_trans = request->req_trans; gds_trans = request->req_trans;
// V4.x multi threading requirements // V4.x multi threading requirements
THREAD_EXIT; THREAD_EXIT();
FOR(REQUEST_HANDLE dbb->dbb_requests[irq_col_default]) FOR(REQUEST_HANDLE dbb->dbb_requests[irq_col_default])
RFL IN RDB$RELATION_FIELDS CROSS 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_SOURCE EQ FLD.RDB$FIELD_NAME AND
RFL.RDB$FIELD_NAME EQ for_col_name RFL.RDB$FIELD_NAME EQ for_col_name
THREAD_ENTER; THREAD_ENTER();
if (!RFL.RDB$DEFAULT_VALUE.NULL) { if (!RFL.RDB$DEFAULT_VALUE.NULL) {
blob_id = &RFL.RDB$DEFAULT_VALUE; blob_id = &RFL.RDB$DEFAULT_VALUE;
@ -417,21 +417,21 @@ USHORT METD_get_col_default(dsql_req* request,
if (*has_default) { if (*has_default) {
// open the blob // open the blob
THREAD_EXIT; THREAD_EXIT();
stat = isc_open_blob2(status_vect, &DB, &gds_trans, stat = isc_open_blob2(status_vect, &DB, &gds_trans,
&blob_handle, blob_id, sizeof(blr_bpb), &blob_handle, blob_id, sizeof(blr_bpb),
blr_bpb); blr_bpb);
THREAD_ENTER; THREAD_ENTER();
if (stat) if (stat)
ERRD_punt(); ERRD_punt();
// fetch segments. Assuming here that the buffer is big enough. // fetch segments. Assuming here that the buffer is big enough.
ptr_in_buffer = buffer; ptr_in_buffer = buffer;
while (true) { while (true) {
THREAD_EXIT; THREAD_EXIT();
stat = isc_get_segment(status_vect, &blob_handle, stat = isc_get_segment(status_vect, &blob_handle,
&length, buff_length, ptr_in_buffer); &length, buff_length, ptr_in_buffer);
THREAD_ENTER; THREAD_ENTER();
ptr_in_buffer = ptr_in_buffer + length; ptr_in_buffer = ptr_in_buffer + length;
buff_length = buff_length - length; buff_length = buff_length - length;
result += length; result += length;
@ -447,9 +447,9 @@ USHORT METD_get_col_default(dsql_req* request,
ERRD_punt(); ERRD_punt();
} }
THREAD_EXIT; THREAD_EXIT();
isc_close_blob(status_vect, &blob_handle); isc_close_blob(status_vect, &blob_handle);
THREAD_ENTER; THREAD_ENTER();
/* the default string must be of the form: /* the default string must be of the form:
blr_version4 blr_literal ..... blr_eoc */ blr_version4 blr_literal ..... blr_eoc */
@ -466,10 +466,10 @@ USHORT METD_get_col_default(dsql_req* request,
result = 2; result = 2;
} }
THREAD_EXIT; THREAD_EXIT();
END_FOR ON_ERROR ERRD_punt(); END_FOR ON_ERROR ERRD_punt();
END_ERROR THREAD_ENTER; END_ERROR THREAD_ENTER();
return result; return result;
} }
@ -508,7 +508,7 @@ dsql_intlsym* METD_get_charset(dsql_req* request, USHORT length, const char* nam
gds_trans = request->req_trans; gds_trans = request->req_trans;
iname = NULL; iname = NULL;
THREAD_EXIT; THREAD_EXIT();
FOR(REQUEST_HANDLE dbb->dbb_requests[irq_charset]) FOR(REQUEST_HANDLE dbb->dbb_requests[irq_charset])
X IN RDB$COLLATIONS 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 Z.RDB$FIELD_NAME EQ "RDB$CHARACTER_SET_NAME"
AND Y.RDB$DEFAULT_COLLATE_NAME EQ X.RDB$COLLATION_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; iname = FB_NEW_RPT(*dbb->dbb_pool, length) dsql_intlsym;
strcpy(iname->intlsym_name, (char*) name); 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 = iname->intlsym_bytes_per_char =
(Y.RDB$BYTES_PER_CHARACTER.NULL) ? 1 : (Y.RDB$BYTES_PER_CHARACTER); (Y.RDB$BYTES_PER_CHARACTER.NULL) ? 1 : (Y.RDB$BYTES_PER_CHARACTER);
THREAD_EXIT; THREAD_EXIT();
END_FOR END_FOR
ON_ERROR ON_ERROR
// Assume V3 database // Assume V3 database
END_ERROR; END_ERROR;
THREAD_ENTER; THREAD_ENTER();
if (!iname) if (!iname)
return NULL; return NULL;
@ -586,32 +586,32 @@ USHORT METD_get_charset_bpc (dsql_req* request,
handle = 0; handle = 0;
THREAD_EXIT; THREAD_EXIT();
FOR (REQUEST_HANDLE handle) FOR (REQUEST_HANDLE handle)
Y IN RDB$CHARACTER_SETS Y IN RDB$CHARACTER_SETS
WITH Y.RDB$CHARACTER_SET_ID EQ charset_id WITH Y.RDB$CHARACTER_SET_ID EQ charset_id
THREAD_ENTER; THREAD_ENTER();
bpc = (Y.RDB$BYTES_PER_CHARACTER.NULL) ? 1 : bpc = (Y.RDB$BYTES_PER_CHARACTER.NULL) ? 1 :
(Y.RDB$BYTES_PER_CHARACTER); (Y.RDB$BYTES_PER_CHARACTER);
THREAD_EXIT; THREAD_EXIT();
END_FOR END_FOR
ON_ERROR ON_ERROR
// Assume V3 database // Assume V3 database
END_ERROR; END_ERROR;
/************* /*************
THREAD_ENTER; THREAD_ENTER();
Un comment these if any code is added after the END_ERROR and Un comment these if any code is added after the END_ERROR and
gds__release request () gds__release request ()
THREAD_EXIT; THREAD_EXIT();
*************/ *************/
isc_release_request (gds_status, &handle); isc_release_request (gds_status, &handle);
THREAD_ENTER; THREAD_ENTER();
return bpc; return bpc;
} }
@ -646,13 +646,13 @@ dsql_str* METD_get_default_charset(dsql_req* request)
handle = 0; handle = 0;
THREAD_EXIT; THREAD_EXIT();
FOR(REQUEST_HANDLE handle) FOR(REQUEST_HANDLE handle)
FIRST 1 DBB IN RDB$DATABASE FIRST 1 DBB IN RDB$DATABASE
WITH DBB.RDB$CHARACTER_SET_NAME NOT MISSING; WITH DBB.RDB$CHARACTER_SET_NAME NOT MISSING;
THREAD_ENTER; THREAD_ENTER();
// Terminate ASCIIZ string on first trailing blank // Terminate ASCIIZ string on first trailing blank
fb_utils::fb_exact_name(DBB.RDB$CHARACTER_SET_NAME); 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++; *p++ = *str_charset++;
} }
THREAD_EXIT; THREAD_EXIT();
END_FOR END_FOR
ON_ERROR ON_ERROR
// Assume V3 database // Assume V3 database
END_ERROR; END_ERROR;
/************* /*************
THREAD_ENTER; THREAD_ENTER();
Un comment these if any code is added after the END_ERROR and Un comment these if any code is added after the END_ERROR and
gds__release request () gds__release request ()
THREAD_EXIT; THREAD_EXIT();
*************/ *************/
isc_release_request(gds_status, &handle); isc_release_request(gds_status, &handle);
THREAD_ENTER; THREAD_ENTER();
if (dbb->dbb_dfl_charset == NULL) if (dbb->dbb_dfl_charset == NULL)
dbb->dbb_flags |= DBB_no_charset; 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; DB = dbb->dbb_database_handle;
gds_trans = request->req_trans; gds_trans = request->req_trans;
THREAD_EXIT; THREAD_EXIT();
FOR(REQUEST_HANDLE dbb->dbb_requests[irq_domain]) FOR(REQUEST_HANDLE dbb->dbb_requests[irq_domain])
FLX IN RDB$FIELDS WITH FLX.RDB$FIELD_NAME EQ name FLX IN RDB$FIELDS WITH FLX.RDB$FIELD_NAME EQ name
THREAD_ENTER; THREAD_ENTER();
found = true; found = true;
field->fld_length = FLX.RDB$FIELD_LENGTH; 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; field->fld_seg_length = FLX.RDB$SEGMENT_LENGTH;
} }
THREAD_EXIT; THREAD_EXIT();
END_FOR END_FOR
ON_ERROR ON_ERROR
END_ERROR; END_ERROR;
THREAD_ENTER; THREAD_ENTER();
return found ? TRUE : FALSE; return found ? TRUE : FALSE;
} }
@ -777,12 +777,12 @@ USHORT METD_get_domain_default(dsql_req* request,
USHORT result = 0; USHORT result = 0;
// V4.x multi threading requirements // V4.x multi threading requirements
THREAD_EXIT; THREAD_EXIT();
FOR(REQUEST_HANDLE dbb->dbb_requests[irq_domain_2]) FOR(REQUEST_HANDLE dbb->dbb_requests[irq_domain_2])
FLD IN RDB$FIELDS WITH FLD.RDB$FIELD_NAME EQ domain_name FLD IN RDB$FIELDS WITH FLD.RDB$FIELD_NAME EQ domain_name
THREAD_ENTER; THREAD_ENTER();
ISC_QUAD* blob_id; ISC_QUAD* blob_id;
if (!FLD.RDB$DEFAULT_VALUE.NULL) { if (!FLD.RDB$DEFAULT_VALUE.NULL) {
@ -794,24 +794,24 @@ USHORT METD_get_domain_default(dsql_req* request,
if (*has_default) { if (*has_default) {
// open the blob // open the blob
THREAD_EXIT; THREAD_EXIT();
isc_blob_handle blob_handle = 0; isc_blob_handle blob_handle = 0;
ISC_STATUS stat = isc_open_blob2(status_vect, &DB, &gds_trans, ISC_STATUS stat = isc_open_blob2(status_vect, &DB, &gds_trans,
&blob_handle, blob_id, sizeof(blr_bpb), &blob_handle, blob_id, sizeof(blr_bpb),
blr_bpb); blr_bpb);
THREAD_ENTER; THREAD_ENTER();
if (stat) if (stat)
ERRD_punt(); ERRD_punt();
// fetch segments. Assume buffer is big enough. // fetch segments. Assume buffer is big enough.
TEXT* ptr_in_buffer = buffer; TEXT* ptr_in_buffer = buffer;
while (true) { while (true) {
THREAD_EXIT; THREAD_EXIT();
USHORT length; USHORT length;
stat = isc_get_segment(status_vect, stat = isc_get_segment(status_vect,
&blob_handle, &blob_handle,
&length, buff_length, ptr_in_buffer); &length, buff_length, ptr_in_buffer);
THREAD_ENTER; THREAD_ENTER();
ptr_in_buffer = ptr_in_buffer + length; ptr_in_buffer = ptr_in_buffer + length;
buff_length = buff_length - length; buff_length = buff_length - length;
result += length; result += length;
@ -827,9 +827,9 @@ USHORT METD_get_domain_default(dsql_req* request,
ERRD_punt(); ERRD_punt();
} }
THREAD_EXIT; THREAD_EXIT();
isc_close_blob(status_vect, &blob_handle); isc_close_blob(status_vect, &blob_handle);
THREAD_ENTER; THREAD_ENTER();
/* the default string must be of the form: /* the default string must be of the form:
blr_version4 blr_literal ..... blr_eoc */ blr_version4 blr_literal ..... blr_eoc */
@ -846,14 +846,14 @@ USHORT METD_get_domain_default(dsql_req* request,
result = 2; result = 2;
} }
THREAD_EXIT; THREAD_EXIT();
END_FOR END_FOR
ON_ERROR ON_ERROR
ERRD_punt(); ERRD_punt();
END_ERROR END_ERROR
THREAD_ENTER; THREAD_ENTER();
return result; return result;
} }
@ -910,13 +910,13 @@ dsql_udf* METD_get_function(dsql_req* request, const dsql_str* name)
DsqlNodStack stack; DsqlNodStack stack;
USHORT return_arg; USHORT return_arg;
THREAD_EXIT; THREAD_EXIT();
FOR(REQUEST_HANDLE dbb->dbb_requests[irq_function]) FOR(REQUEST_HANDLE dbb->dbb_requests[irq_function])
X IN RDB$FUNCTIONS WITH X IN RDB$FUNCTIONS WITH
X.RDB$FUNCTION_NAME EQ name->str_data X.RDB$FUNCTION_NAME EQ name->str_data
THREAD_ENTER; THREAD_ENTER();
userFunc = FB_NEW_RPT(*dbb->dbb_pool, name->str_length) dsql_udf; 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. /* 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; return_arg = X.RDB$RETURN_ARGUMENT;
userFunc->udf_arguments = 0; userFunc->udf_arguments = 0;
THREAD_EXIT; THREAD_EXIT();
END_FOR END_FOR
ON_ERROR ON_ERROR
END_ERROR; END_ERROR;
THREAD_ENTER; THREAD_ENTER();
if (!userFunc) { if (!userFunc) {
metd_rec_unlock(); 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 * the one that is appropriate for the database we are
* working against. * working against.
*/ */
THREAD_EXIT; THREAD_EXIT();
if (dbb->dbb_flags & DBB_v3) { if (dbb->dbb_flags & DBB_v3) {
FOR(REQUEST_HANDLE dbb->dbb_requests[irq_func_return]) 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$FUNCTION_NAME EQ name->str_data AND
X.RDB$ARGUMENT_POSITION EQ return_arg X.RDB$ARGUMENT_POSITION EQ return_arg
THREAD_ENTER; THREAD_ENTER();
userFunc->udf_dtype = (X.RDB$FIELD_TYPE != blr_blob) ? userFunc->udf_dtype = (X.RDB$FIELD_TYPE != blr_blob) ?
gds_cvt_blr_dtype[X.RDB$FIELD_TYPE] : dtype_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_sub_type = X.RDB$FIELD_SUB_TYPE;
userFunc->udf_length = X.RDB$FIELD_LENGTH; userFunc->udf_length = X.RDB$FIELD_LENGTH;
THREAD_EXIT; THREAD_EXIT();
END_FOR END_FOR
ON_ERROR 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 X.RDB$FUNCTION_NAME EQ name->str_data
SORTED BY X.RDB$ARGUMENT_POSITION SORTED BY X.RDB$ARGUMENT_POSITION
THREAD_ENTER; THREAD_ENTER();
if (X.RDB$ARGUMENT_POSITION == return_arg) { if (X.RDB$ARGUMENT_POSITION == return_arg) {
userFunc->udf_dtype = (X.RDB$FIELD_TYPE != blr_blob) ? 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); stack.push(udf_param_node);
} }
THREAD_EXIT; THREAD_EXIT();
END_FOR END_FOR
ON_ERROR ON_ERROR
END_ERROR; END_ERROR;
} }
THREAD_ENTER; THREAD_ENTER();
/* Adjust the return type & length of the UDF to account for /* Adjust the return type & length of the UDF to account for
* cstring & varying. While a UDF can return CSTRING, we convert it * 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; dsql_nod* list = NULL;
USHORT count = 0; USHORT count = 0;
THREAD_EXIT; THREAD_EXIT();
FOR(REQUEST_HANDLE dbb->dbb_requests[irq_primary_key]) FOR(REQUEST_HANDLE dbb->dbb_requests[irq_primary_key])
X IN RDB$INDICES CROSS 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" AND Z.RDB$CONSTRAINT_TYPE EQ "PRIMARY KEY"
SORTED BY Y.RDB$FIELD_POSITION SORTED BY Y.RDB$FIELD_POSITION
THREAD_ENTER; THREAD_ENTER();
if (!list) if (!list)
list = MAKE_node(nod_list, (int) X.RDB$SEGMENT_COUNT); 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; list->nod_arg[count] = field_node;
count++; count++;
THREAD_EXIT; THREAD_EXIT();
END_FOR END_FOR
ON_ERROR ON_ERROR
END_ERROR; END_ERROR;
THREAD_ENTER; THREAD_ENTER();
return list; return list;
} }
@ -1230,13 +1230,13 @@ dsql_prc* METD_get_procedure(dsql_req* request, const dsql_str* name)
gds_trans = request->req_trans; gds_trans = request->req_trans;
procedure = NULL; procedure = NULL;
THREAD_EXIT; THREAD_EXIT();
FOR(REQUEST_HANDLE dbb->dbb_requests[irq_procedure]) FOR(REQUEST_HANDLE dbb->dbb_requests[irq_procedure])
X IN RDB$PROCEDURES WITH X IN RDB$PROCEDURES WITH
X.RDB$PROCEDURE_NAME EQ name->str_data X.RDB$PROCEDURE_NAME EQ name->str_data
THREAD_ENTER; THREAD_ENTER();
fb_utils::fb_exact_name(X.RDB$OWNER_NAME); 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_name, (TEXT *) name->str_data);
strcpy(procedure->prc_owner, (TEXT *) X.RDB$OWNER_NAME); strcpy(procedure->prc_owner, (TEXT *) X.RDB$OWNER_NAME);
THREAD_EXIT; THREAD_EXIT();
END_FOR END_FOR
ON_ERROR ON_ERROR
END_ERROR; END_ERROR;
THREAD_ENTER; THREAD_ENTER();
if (!procedure) { if (!procedure) {
metd_rec_unlock(); metd_rec_unlock();
@ -1271,7 +1271,7 @@ dsql_prc* METD_get_procedure(dsql_req* request, const dsql_str* name)
ptr = &procedure->prc_inputs; ptr = &procedure->prc_inputs;
count = defaults = 0; count = defaults = 0;
THREAD_EXIT; THREAD_EXIT();
FOR(REQUEST_HANDLE dbb->dbb_requests[irq_parameters]) FOR(REQUEST_HANDLE dbb->dbb_requests[irq_parameters])
PR IN RDB$PROCEDURE_PARAMETERS CROSS 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 AND PR.RDB$PARAMETER_TYPE = type
SORTED BY DESCENDING PR.RDB$PARAMETER_NUMBER SORTED BY DESCENDING PR.RDB$PARAMETER_NUMBER
THREAD_ENTER; THREAD_ENTER();
count++; count++;
// allocate the field block // allocate the field block
@ -1321,13 +1321,13 @@ dsql_prc* METD_get_procedure(dsql_req* request, const dsql_str* name)
defaults++; defaults++;
} }
THREAD_EXIT; THREAD_EXIT();
END_FOR END_FOR
ON_ERROR ON_ERROR
END_ERROR; END_ERROR;
THREAD_ENTER; THREAD_ENTER();
if (type) if (type)
procedure->prc_out_count = count; 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; gds_trans = request->req_trans;
relation = NULL; relation = NULL;
THREAD_EXIT; THREAD_EXIT();
FOR(REQUEST_HANDLE dbb->dbb_requests[irq_relation]) FOR(REQUEST_HANDLE dbb->dbb_requests[irq_relation])
X IN RDB$RELATIONS WITH X.RDB$RELATION_NAME EQ name->str_data 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 been assigned, and this is a type of request which does not
use ids, prepare a temporary relation block to provide use ids, prepare a temporary relation block to provide
information without caching it */ information without caching it */
THREAD_ENTER; THREAD_ENTER();
fb_utils::fb_exact_name(X.RDB$OWNER_NAME); 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 END_FOR
ON_ERROR ON_ERROR
END_ERROR; END_ERROR;
THREAD_ENTER; THREAD_ENTER();
if (!relation) { if (!relation) {
metd_rec_unlock(); metd_rec_unlock();
@ -1489,7 +1489,7 @@ dsql_rel* METD_get_relation(dsql_req* request, const dsql_str* name)
ptr = &relation->rel_fields; ptr = &relation->rel_fields;
THREAD_EXIT; THREAD_EXIT();
if (dbb->dbb_flags & DBB_v3) { if (dbb->dbb_flags & DBB_v3) {
FOR(REQUEST_HANDLE dbb->dbb_requests[irq_fields]) 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 AND RFR.RDB$RELATION_NAME EQ name->str_data
SORTED BY RFR.RDB$FIELD_POSITION SORTED BY RFR.RDB$FIELD_POSITION
THREAD_ENTER; THREAD_ENTER();
// allocate the field block // 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; field->fld_flags |= FLD_nullable;
THREAD_EXIT; THREAD_EXIT();
END_FOR END_FOR
ON_ERROR 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 AND RFR.RDB$RELATION_NAME EQ name->str_data
SORTED BY RFR.RDB$FIELD_POSITION SORTED BY RFR.RDB$FIELD_POSITION
THREAD_ENTER; THREAD_ENTER();
// allocate the field block // 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; field->fld_flags |= FLD_nullable;
} }
THREAD_EXIT; THREAD_EXIT();
END_FOR END_FOR
ON_ERROR ON_ERROR
END_ERROR; END_ERROR;
} }
THREAD_ENTER; THREAD_ENTER();
/* Since we could give up control due to the THREAD_EXIT and THEAD_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 * 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; relation = NULL;
THREAD_EXIT; THREAD_EXIT();
FOR(REQUEST_HANDLE dbb->dbb_requests[irq_trigger]) FOR(REQUEST_HANDLE dbb->dbb_requests[irq_trigger])
X IN RDB$TRIGGERS WITH X.RDB$TRIGGER_NAME EQ name->str_data 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); fb_utils::fb_exact_name(X.RDB$RELATION_NAME);
relation = MAKE_string(X.RDB$RELATION_NAME, strlen(X.RDB$RELATION_NAME)); relation = MAKE_string(X.RDB$RELATION_NAME, strlen(X.RDB$RELATION_NAME));
*trig_type = X.RDB$TRIGGER_TYPE; *trig_type = X.RDB$TRIGGER_TYPE;
THREAD_EXIT; THREAD_EXIT();
END_FOR END_FOR
ON_ERROR ON_ERROR
END_ERROR; END_ERROR;
THREAD_ENTER; THREAD_ENTER();
return relation; return relation;
} }
@ -1721,24 +1721,24 @@ USHORT METD_get_type(dsql_req* request, const dsql_str* name, char* field, SSHOR
found = FALSE; found = FALSE;
THREAD_EXIT; THREAD_EXIT();
FOR(REQUEST_HANDLE dbb->dbb_requests[irq_type]) FOR(REQUEST_HANDLE dbb->dbb_requests[irq_type])
X IN RDB$TYPES WITH X IN RDB$TYPES WITH
X.RDB$FIELD_NAME EQ field AND X.RDB$TYPE_NAME EQ name->str_data; X.RDB$FIELD_NAME EQ field AND X.RDB$TYPE_NAME EQ name->str_data;
THREAD_ENTER; THREAD_ENTER();
found = TRUE; found = TRUE;
*value = X.RDB$TYPE; *value = X.RDB$TYPE;
THREAD_EXIT; THREAD_EXIT();
END_FOR END_FOR
ON_ERROR ON_ERROR
END_ERROR; END_ERROR;
THREAD_ENTER; THREAD_ENTER();
return found; return found;
} }
@ -1768,12 +1768,12 @@ dsql_rel* METD_get_view_relation(dsql_req* request,
DB = dbb->dbb_database_handle; DB = dbb->dbb_database_handle;
gds_trans = request->req_trans; gds_trans = request->req_trans;
THREAD_EXIT; THREAD_EXIT();
FOR(REQUEST_HANDLE dbb->dbb_requests[irq_view], LEVEL level) FOR(REQUEST_HANDLE dbb->dbb_requests[irq_view], LEVEL level)
X IN RDB$VIEW_RELATIONS WITH X.RDB$VIEW_NAME EQ view_name 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$CONTEXT_NAME);
fb_utils::fb_exact_name(X.RDB$RELATION_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; return relation;
} }
THREAD_EXIT; THREAD_EXIT();
END_FOR END_FOR
ON_ERROR ON_ERROR
END_ERROR; END_ERROR;
THREAD_ENTER; THREAD_ENTER();
return NULL; 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; DB = dbb->dbb_database_handle;
gds_trans = request->req_trans; gds_trans = request->req_trans;
THREAD_EXIT; THREAD_EXIT();
FOR(REQUEST_HANDLE dbb->dbb_requests[irq_dimensions]) FOR(REQUEST_HANDLE dbb->dbb_requests[irq_dimensions])
X IN RDB$FIELDS WITH X.RDB$FIELD_NAME EQ field_name X IN RDB$FIELDS WITH X.RDB$FIELD_NAME EQ field_name
THREAD_ENTER; THREAD_ENTER();
if (!X.RDB$DIMENSIONS.NULL && X.RDB$DIMENSIONS) { if (!X.RDB$DIMENSIONS.NULL && X.RDB$DIMENSIONS) {
field->fld_element_dtype = field->fld_dtype; 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; field->fld_dimensions = X.RDB$DIMENSIONS;
} }
THREAD_EXIT; THREAD_EXIT();
END_FOR END_FOR
ON_ERROR ON_ERROR
dbb->dbb_flags |= DBB_no_arrays; dbb->dbb_flags |= DBB_no_arrays;
END_ERROR; END_ERROR;
THREAD_ENTER; THREAD_ENTER();
} }

View File

@ -4379,10 +4379,10 @@ static bool send_and_wait( ICC icc)
// next, wait for the server to signal us back or die // next, wait for the server to signal us back or die
THREAD_EXIT; THREAD_EXIT();
result = result =
WaitForMultipleObjects((DWORD) 2, icc->icc_waits, FALSE, INFINITE); WaitForMultipleObjects((DWORD) 2, icc->icc_waits, FALSE, INFINITE);
THREAD_ENTER; THREAD_ENTER();
if (result != WAIT_OBJECT_0) { if (result != WAIT_OBJECT_0) {
icc->icc_flags |= ICCF_UNMAP_CLIENT; icc->icc_flags |= ICCF_UNMAP_CLIENT;

View File

@ -659,9 +659,9 @@ const int CCH_EXCLUSIVE_RETRY_INTERVAL =1; /* retry interval in seconds */
if (remaining > CCH_EXCLUSIVE_RETRY_INTERVAL) if (remaining > CCH_EXCLUSIVE_RETRY_INTERVAL)
{ {
THREAD_EXIT; THREAD_EXIT();
THREAD_SLEEP(CCH_EXCLUSIVE_RETRY_INTERVAL * 1000); THREAD_SLEEP(CCH_EXCLUSIVE_RETRY_INTERVAL * 1000);
THREAD_ENTER; THREAD_ENTER();
} }
#ifdef CANCEL_OPERATION #ifdef CANCEL_OPERATION
@ -991,7 +991,7 @@ void CCH_fetch_page(
AST_CHECK; AST_CHECK;
++dbb->dbb_reads; ++dbb->dbb_reads;
#ifdef SUPERSERVER #ifdef SUPERSERVER
THREAD_EXIT; THREAD_EXIT();
#endif #endif
page = bdb->bdb_buffer; page = bdb->bdb_buffer;
jrd_file* file = dbb->dbb_file; jrd_file* file = dbb->dbb_file;
@ -1050,7 +1050,7 @@ void CCH_fetch_page(
break; break;
} }
#ifdef SUPERSERVER #ifdef SUPERSERVER
THREAD_ENTER; THREAD_ENTER();
#endif #endif
if (!CCH_rollover_to_shadow(dbb, file, false)) { if (!CCH_rollover_to_shadow(dbb, file, false)) {
PAGE_LOCK_RELEASE(bdb->bdb_lock); PAGE_LOCK_RELEASE(bdb->bdb_lock);
@ -1070,7 +1070,7 @@ void CCH_fetch_page(
} }
} }
#ifdef SUPERSERVER #ifdef SUPERSERVER
THREAD_EXIT; THREAD_EXIT();
#endif #endif
} }
} }
@ -1100,7 +1100,7 @@ void CCH_fetch_page(
break; break;
} }
#ifdef SUPERSERVER #ifdef SUPERSERVER
THREAD_ENTER; THREAD_ENTER();
#endif #endif
if (!CCH_rollover_to_shadow(dbb, file, false)) { if (!CCH_rollover_to_shadow(dbb, file, false)) {
PAGE_LOCK_RELEASE(bdb->bdb_lock); PAGE_LOCK_RELEASE(bdb->bdb_lock);
@ -1120,7 +1120,7 @@ void CCH_fetch_page(
} }
} }
#ifdef SUPERSERVER #ifdef SUPERSERVER
THREAD_EXIT; THREAD_EXIT();
#endif #endif
} }
} }
@ -1135,7 +1135,7 @@ void CCH_fetch_page(
&& !(dbb->dbb_flags & DBB_damaged))) && !(dbb->dbb_flags & DBB_damaged)))
{ {
#ifdef SUPERSERVER #ifdef SUPERSERVER
THREAD_ENTER; THREAD_ENTER();
#endif #endif
IBERR_build_status(tdbb->tdbb_status_vector, IBERR_build_status(tdbb->tdbb_status_vector,
isc_db_corrupt, isc_db_corrupt,
@ -1151,7 +1151,7 @@ void CCH_fetch_page(
#endif /* NO_CHECKSUM */ #endif /* NO_CHECKSUM */
#ifdef SUPERSERVER #ifdef SUPERSERVER
THREAD_ENTER; THREAD_ENTER();
#endif #endif
AST_CHECK; AST_CHECK;
@ -1217,9 +1217,9 @@ void CCH_fini(thread_db* tdbb)
bcb->bcb_flags &= ~BCB_cache_reader; bcb->bcb_flags &= ~BCB_cache_reader;
ISC_event_post(event); ISC_event_post(event);
SLONG count = ISC_event_clear(event); SLONG count = ISC_event_clear(event);
THREAD_EXIT; THREAD_EXIT();
ISC_event_wait(1, &event, &count, 0, NULL, 0); ISC_event_wait(1, &event, &count, 0, NULL, 0);
THREAD_ENTER; THREAD_ENTER();
/* Now dispose off the cache reader associated semaphore */ /* Now dispose off the cache reader associated semaphore */
ISC_event_fini(event); ISC_event_fini(event);
} }
@ -1237,9 +1237,9 @@ void CCH_fini(thread_db* tdbb)
bcb->bcb_flags &= ~BCB_cache_writer; bcb->bcb_flags &= ~BCB_cache_writer;
ISC_event_post(dbb->dbb_writer_event); /* Wake up running thread */ ISC_event_post(dbb->dbb_writer_event); /* Wake up running thread */
THREAD_EXIT; THREAD_EXIT();
ISC_event_wait(1, &event, &count, 0, NULL, 0); ISC_event_wait(1, &event, &count, 0, NULL, 0);
THREAD_ENTER; THREAD_ENTER();
/* Cleanup initialization event */ /* Cleanup initialization event */
ISC_event_fini(event); ISC_event_fini(event);
} }
@ -1713,9 +1713,9 @@ void CCH_init(thread_db* tdbb, ULONG number)
ERR_bugcheck_msg("cannot start thread"); ERR_bugcheck_msg("cannot start thread");
} }
THREAD_EXIT; THREAD_EXIT();
ISC_event_wait(1, &event, &count, 5 * 1000000, NULL, 0); ISC_event_wait(1, &event, &count, 5 * 1000000, NULL, 0);
THREAD_ENTER; THREAD_ENTER();
#endif #endif
#ifdef CACHE_WRITER #ifdef CACHE_WRITER
@ -1731,9 +1731,9 @@ void CCH_init(thread_db* tdbb, ULONG number)
{ {
ERR_bugcheck_msg("cannot start thread"); ERR_bugcheck_msg("cannot start thread");
} }
THREAD_EXIT; THREAD_EXIT();
ISC_event_wait(1, &event, &count, 5 * 1000000, NULL, 0); ISC_event_wait(1, &event, &count, 5 * 1000000, NULL, 0);
THREAD_ENTER; THREAD_ENTER();
/* Clean up initialization event */ /* Clean up initialization event */
ISC_event_fini(event); ISC_event_fini(event);
} }
@ -3067,7 +3067,7 @@ static void THREAD_ROUTINE cache_reader(Database* dbb)
* busy at a time. * busy at a time.
* *
**************************************/ **************************************/
THREAD_ENTER; THREAD_ENTER();
/* Establish a thread context. */ /* Establish a thread context. */
/* Note: Since this function operates as its own thread, /* 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) { catch (const std::exception& ex) {
Firebird::stuff_exception(status_vector, ex); Firebird::stuff_exception(status_vector, ex);
gds__log_status(dbb->dbb_file->fil_string, status_vector); gds__log_status(dbb->dbb_file->fil_string, status_vector);
THREAD_EXIT; THREAD_EXIT();
return; return;
} }
@ -3127,9 +3127,9 @@ static void THREAD_ROUTINE cache_reader(Database* dbb)
prf* next_prefetch = &prefetch1; prf* next_prefetch = &prefetch1;
if (dbb->dbb_flags & DBB_suspend_bgio) { if (dbb->dbb_flags & DBB_suspend_bgio) {
THREAD_EXIT; THREAD_EXIT();
ISC_event_wait(1, &reader_event, &count, 10 * 1000000, NULL, 0); ISC_event_wait(1, &reader_event, &count, 10 * 1000000, NULL, 0);
THREAD_ENTER; THREAD_ENTER();
continue; continue;
} }
@ -3197,9 +3197,9 @@ static void THREAD_ROUTINE cache_reader(Database* dbb)
} }
else { else {
bcb->bcb_flags &= ~BCB_reader_active; bcb->bcb_flags &= ~BCB_reader_active;
THREAD_EXIT; THREAD_EXIT();
ISC_event_wait(1, &reader_event, &count, 10 * 1000000, NULL, 0); ISC_event_wait(1, &reader_event, &count, 10 * 1000000, NULL, 0);
THREAD_ENTER; THREAD_ENTER();
} }
bcb = dbb->dbb_bcb; bcb = dbb->dbb_bcb;
} }
@ -3208,7 +3208,7 @@ static void THREAD_ROUTINE cache_reader(Database* dbb)
delete tdbb->tdbb_attachment; delete tdbb->tdbb_attachment;
bcb->bcb_flags &= ~BCB_cache_reader; bcb->bcb_flags &= ~BCB_cache_reader;
ISC_event_post(reader_event); ISC_event_post(reader_event);
THREAD_EXIT; THREAD_EXIT();
} // try } // try
catch (const std::exception& ex) { catch (const std::exception& ex) {
@ -3236,7 +3236,7 @@ static void THREAD_ROUTINE cache_writer(Database* dbb)
* deems it necessary. * deems it necessary.
* *
**************************************/ **************************************/
THREAD_ENTER; THREAD_ENTER();
/* Establish a thread context. */ /* Establish a thread context. */
/* Note: Since this function operates as its own thread, /* 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); Firebird::stuff_exception(status_vector, ex);
gds__log_status(dbb->dbb_file->fil_string, status_vector); gds__log_status(dbb->dbb_file->fil_string, status_vector);
ISC_event_fini(writer_event); ISC_event_fini(writer_event);
THREAD_EXIT; THREAD_EXIT();
return; return;
} }
@ -3288,9 +3288,9 @@ static void THREAD_ROUTINE cache_writer(Database* dbb)
SLONG starting_page = -1; SLONG starting_page = -1;
if (dbb->dbb_flags & DBB_suspend_bgio) { if (dbb->dbb_flags & DBB_suspend_bgio) {
THREAD_EXIT; THREAD_EXIT();
ISC_event_wait(1, &writer_event, &count, 10 * 1000000, NULL, 0); ISC_event_wait(1, &writer_event, &count, 10 * 1000000, NULL, 0);
THREAD_ENTER; THREAD_ENTER();
continue; continue;
} }
@ -3305,9 +3305,9 @@ static void THREAD_ROUTINE cache_writer(Database* dbb)
} }
#endif #endif
THREAD_EXIT; THREAD_EXIT();
THREAD_YIELD; THREAD_YIELD();
THREAD_ENTER; THREAD_ENTER();
if (bcb->bcb_flags & BCB_free_pending) { if (bcb->bcb_flags & BCB_free_pending) {
BufferDesc* bdb = get_buffer(tdbb, FREE_PAGE, LATCH_none, 1); BufferDesc* bdb = get_buffer(tdbb, FREE_PAGE, LATCH_none, 1);
@ -3357,9 +3357,9 @@ static void THREAD_ROUTINE cache_writer(Database* dbb)
#endif #endif
else { else {
bcb->bcb_flags &= ~BCB_writer_active; bcb->bcb_flags &= ~BCB_writer_active;
THREAD_EXIT; THREAD_EXIT();
ISC_event_wait(1, &writer_event, &count, 10 * 1000000, NULL, 0); ISC_event_wait(1, &writer_event, &count, 10 * 1000000, NULL, 0);
THREAD_ENTER; THREAD_ENTER();
} }
bcb = dbb->dbb_bcb; bcb = dbb->dbb_bcb;
} }
@ -3370,7 +3370,7 @@ static void THREAD_ROUTINE cache_writer(Database* dbb)
/* Notify the finalization caller that we're finishing. */ /* Notify the finalization caller that we're finishing. */
ISC_event_post(dbb->dbb_writer_event_fini); ISC_event_post(dbb->dbb_writer_event_fini);
ISC_event_fini(writer_event); ISC_event_fini(writer_event);
THREAD_EXIT; THREAD_EXIT();
} // try } // try
catch (const std::exception& ex) { 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: /* This code is only used by the background I/O threads:
cache writer, cache reader and garbage collector. */ cache writer, cache reader and garbage collector. */
THREAD_EXIT; THREAD_EXIT();
for (que_inst = bcb->bcb_in_use.que_backward; for (que_inst = bcb->bcb_in_use.que_backward;
que_inst != &bcb->bcb_in_use; que_inst = que_inst->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; continue;
} }
if (bdb->bdb_flags & BDB_db_dirty) { if (bdb->bdb_flags & BDB_db_dirty) {
THREAD_ENTER; THREAD_ENTER();
// BCB_MUTEX_RELEASE; // BCB_MUTEX_RELEASE;
return bdb; return bdb;
} }
@ -3971,14 +3971,14 @@ static BufferDesc* get_buffer(thread_db* tdbb, SLONG page, LATCH latch, SSHORT l
else { /* if (page == CHECKPOINT_PAGE) */ else { /* if (page == CHECKPOINT_PAGE) */
if (bdb->bdb_flags & BDB_checkpoint) { if (bdb->bdb_flags & BDB_checkpoint) {
THREAD_ENTER; THREAD_ENTER();
// BCB_MUTEX_RELEASE; // BCB_MUTEX_RELEASE;
return bdb; return bdb;
} }
} }
} }
THREAD_ENTER; THREAD_ENTER();
// BCB_MUTEX_RELEASE; // BCB_MUTEX_RELEASE;
return NULL; return NULL;
} }
@ -4390,7 +4390,7 @@ static SSHORT latch_bdb(
count = ISC_event_clear(event)) count = ISC_event_clear(event))
{ {
// LATCH_MUTEX_RELEASE; // LATCH_MUTEX_RELEASE;
THREAD_EXIT; THREAD_EXIT();
if (latch_wait == 1) { if (latch_wait == 1) {
timeout_occurred = timeout_occurred =
ISC_event_wait(1, &event, &count, 120 * 1000000, NULL, event); 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, ISC_event_wait(1, &event, &count, -latch_wait * 1000000,
NULL, event); NULL, event);
} }
THREAD_ENTER; THREAD_ENTER();
// LATCH_MUTEX_ACQUIRE; // LATCH_MUTEX_ACQUIRE;
} }
@ -4810,10 +4810,10 @@ static void prefetch_epilogue(Prefetch* prefetch, ISC_STATUS* status_vector)
return; return;
} }
THREAD_EXIT; THREAD_EXIT();
prefetch->prf_piob.piob_wait = TRUE; prefetch->prf_piob.piob_wait = TRUE;
const bool async_status = PIO_status(&prefetch->prf_piob, status_vector); 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 /* If there was an I/O error release all buffer latches acquired
for the prefetch request. */ 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); ISC_event_post(dbb->dbb_reader_event);
} }
THREAD_EXIT; THREAD_EXIT();
const bool async_status = const bool async_status =
PIO_read_ahead(dbb, prefetch->prf_start_page, PIO_read_ahead(dbb, prefetch->prf_start_page,
prefetch->prf_io_buffer, prefetch->prf_page_count, prefetch->prf_io_buffer, prefetch->prf_page_count,
&prefetch->prf_piob, status_vector); &prefetch->prf_piob, status_vector);
THREAD_ENTER; THREAD_ENTER();
if (!async_status) { if (!async_status) {
BufferDesc** next_bdb = prefetch->prf_bdbs; BufferDesc** next_bdb = prefetch->prf_bdbs;
for (USHORT i = 0; i < prefetch->prf_max_prefetch; i++) { for (USHORT i = 0; i < prefetch->prf_max_prefetch; i++) {
@ -5576,12 +5576,12 @@ static bool write_page(
else { else {
// We need to write our pages to main database files // We need to write our pages to main database files
#ifdef SUPERSERVER #ifdef SUPERSERVER
THREAD_EXIT; THREAD_EXIT();
#endif #endif
jrd_file* file = dbb->dbb_file; jrd_file* file = dbb->dbb_file;
while (!PIO_write(file, bdb, page, status)) { while (!PIO_write(file, bdb, page, status)) {
#ifdef SUPERSERVER #ifdef SUPERSERVER
THREAD_ENTER; THREAD_ENTER();
#endif #endif
if (!CCH_rollover_to_shadow(dbb, file, inAst)) { if (!CCH_rollover_to_shadow(dbb, file, inAst)) {
bdb->bdb_flags |= BDB_io_error; bdb->bdb_flags |= BDB_io_error;
@ -5589,13 +5589,13 @@ static bool write_page(
return false; return false;
} }
#ifdef SUPERSERVER #ifdef SUPERSERVER
THREAD_EXIT; THREAD_EXIT();
#endif #endif
file = dbb->dbb_file; file = dbb->dbb_file;
} }
#ifdef SUPERSERVER #ifdef SUPERSERVER
THREAD_ENTER; THREAD_ENTER();
#endif #endif
if (bdb->bdb_page == HEADER_PAGE) { if (bdb->bdb_page == HEADER_PAGE) {
dbb->dbb_last_header_write = dbb->dbb_last_header_write =

View File

@ -2712,9 +2712,9 @@ static bool delete_relation(thread_db* tdbb, SSHORT phase, DeferredWork* work,
break; break;
} }
THREAD_EXIT; THREAD_EXIT();
THREAD_SLEEP(1 * 1000); THREAD_SLEEP(1 * 1000);
THREAD_ENTER; THREAD_ENTER();
} }
if (relation->rel_sweep_count) 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); THD_rec_mutex_init(&tdbb->tdbb_database->dbb_sp_rec_mutex);
tdbb->tdbb_database->dbb_flags |= DBB_sp_rec_mutex_init; 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)) if (THD_rec_mutex_lock(&tdbb->tdbb_database->dbb_sp_rec_mutex))
{ {
THREAD_ENTER; THREAD_ENTER();
return false; return false;
} }
THREAD_ENTER; THREAD_ENTER();
#endif /* SUPERSERVER */ #endif /* SUPERSERVER */
// Do not allow to modify procedure used by user requests // Do not allow to modify procedure used by user requests
if (procedure->prc_use_count && MET_procedure_in_use(tdbb,procedure)) if (procedure->prc_use_count && MET_procedure_in_use(tdbb,procedure))

View File

@ -132,9 +132,9 @@ void DYN_ddl(Attachment* attachment, jrd_tra* transaction, USHORT length,
try { try {
#if defined(SUPERSERVER) && defined(WIN_NT) #if defined(SUPERSERVER) && defined(WIN_NT)
THREAD_EXIT; THREAD_EXIT();
THD_MUTEX_LOCK(dbb->dbb_mutexes + DBB_MUTX_dyn); THD_MUTEX_LOCK(dbb->dbb_mutexes + DBB_MUTX_dyn);
THREAD_ENTER; THREAD_ENTER();
#else #else
#ifdef V4_THREADING #ifdef V4_THREADING
V4_JRD_MUTEX_LOCK(dbb->dbb_mutexes + DBB_MUTX_dyn); V4_JRD_MUTEX_LOCK(dbb->dbb_mutexes + DBB_MUTX_dyn);

View File

@ -642,9 +642,9 @@ static FRB alloc_global(UCHAR type, ULONG length, bool recurse)
while (true) { while (true) {
release(); release();
THREAD_EXIT; THREAD_EXIT();
Sleep(3); Sleep(3);
THREAD_ENTER; THREAD_ENTER();
acquire(); acquire();
process = (PRB) SRQ_ABS_PTR(EVENT_process_offset); 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)) { while (session->ses_flags & SES_delivering && (++kill_anyway != 40)) {
release(); release();
THREAD_EXIT; THREAD_EXIT();
#ifdef WIN_NT #ifdef WIN_NT
Sleep(250); Sleep(250);
#endif #endif
#if (defined SOLARIS_MT || defined LINUX) #if (defined SOLARIS_MT || defined LINUX)
sleep(1); sleep(1);
#endif #endif
THREAD_ENTER; THREAD_ENTER();
acquire(); acquire();
session = (SES) SRQ_ABS_PTR(session_id); session = (SES) SRQ_ABS_PTR(session_id);
} }

View File

@ -123,7 +123,7 @@ void ExecuteStatement::Open(thread_db* tdbb, jrd_nod* sql, SSHORT nVars, bool Si
Sqlda->version = 1; Sqlda->version = 1;
tdbb->tdbb_transaction->tra_callback_count++; tdbb->tdbb_transaction->tra_callback_count++;
THREAD_EXIT; THREAD_EXIT();
// For normal diagnostic // For normal diagnostic
const int max_diag_len = 50; 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 # undef Chk
err_handler: err_handler:
THREAD_ENTER; THREAD_ENTER();
tdbb->tdbb_transaction->tra_callback_count--; tdbb->tdbb_transaction->tra_callback_count--;
if (status[0] == 1 && status[1]) { if (status[0] == 1 && status[1]) {
memcpy(tdbb->tdbb_status_vector, status, sizeof(local)); 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)); memset(local, 0, sizeof(local));
status = local; status = local;
tdbb->tdbb_transaction->tra_callback_count++; tdbb->tdbb_transaction->tra_callback_count++;
THREAD_EXIT; THREAD_EXIT();
if (isc_dsql_fetch(status, &Statement, if (isc_dsql_fetch(status, &Statement,
SQLDA_VERSION1, Sqlda) == 100) SQLDA_VERSION1, Sqlda) == 100)
{ {
isc_dsql_free_statement(status, &Statement, DSQL_drop); isc_dsql_free_statement(status, &Statement, DSQL_drop);
THREAD_ENTER; THREAD_ENTER();
tdbb->tdbb_transaction->tra_callback_count--; tdbb->tdbb_transaction->tra_callback_count--;
Statement = 0; Statement = 0;
return false; return false;
} }
THREAD_ENTER; THREAD_ENTER();
tdbb->tdbb_transaction->tra_callback_count--; tdbb->tdbb_transaction->tra_callback_count--;
if (status[0] == 1 && status[1]) { if (status[0] == 1 && status[1]) {
memcpy(tdbb->tdbb_status_vector, status, sizeof(local)); memcpy(tdbb->tdbb_status_vector, status, sizeof(local));
@ -260,17 +260,17 @@ rec_err:
if (SingleMode) { if (SingleMode) {
tdbb->tdbb_transaction->tra_callback_count++; tdbb->tdbb_transaction->tra_callback_count++;
THREAD_EXIT; THREAD_EXIT();
if (isc_dsql_fetch(status, &Statement, if (isc_dsql_fetch(status, &Statement,
SQLDA_VERSION1, Sqlda) == 100) SQLDA_VERSION1, Sqlda) == 100)
{ {
isc_dsql_free_statement(status, &Statement, DSQL_drop); isc_dsql_free_statement(status, &Statement, DSQL_drop);
THREAD_ENTER; THREAD_ENTER();
tdbb->tdbb_transaction->tra_callback_count--; tdbb->tdbb_transaction->tra_callback_count--;
Statement = 0; Statement = 0;
return false; return false;
} }
THREAD_ENTER; THREAD_ENTER();
tdbb->tdbb_transaction->tra_callback_count--; tdbb->tdbb_transaction->tra_callback_count--;
if (! (status[0] == 1 && status[1])) { if (! (status[0] == 1 && status[1])) {
status[0] = isc_arg_gds; status[0] = isc_arg_gds;
@ -287,10 +287,10 @@ void ExecuteStatement::Close(thread_db* tdbb)
{ {
if (Statement) { if (Statement) {
tdbb->tdbb_transaction->tra_callback_count++; tdbb->tdbb_transaction->tra_callback_count++;
THREAD_EXIT; THREAD_EXIT();
// for a while don't check for errors while freeing statement // for a while don't check for errors while freeing statement
isc_dsql_free_statement(0, &Statement, DSQL_drop); isc_dsql_free_statement(0, &Statement, DSQL_drop);
THREAD_ENTER; THREAD_ENTER();
tdbb->tdbb_transaction->tra_callback_count--; tdbb->tdbb_transaction->tra_callback_count--;
Statement = 0; Statement = 0;
} }

View File

@ -30,7 +30,7 @@
* 2003.08.10 Claudio Valderrama: Fix SF Bugs #544132 and #728839. * 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" #include "firebird.h"
@ -795,9 +795,9 @@ static SLONG blob_lseek( blb* blob, USHORT mode, SLONG offset)
* *
**************************************/ **************************************/
/* add thread enter and thread_exit wrappers */ /* add thread enter and thread_exit wrappers */
THREAD_ENTER; THREAD_ENTER();
const SLONG return_offset = BLB_lseek(blob, mode, offset); const SLONG return_offset = BLB_lseek(blob, mode, offset);
THREAD_EXIT; THREAD_EXIT();
return (return_offset); 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 /* As this is a call-back from a UDF, must reacquire the
engine mutex */ engine mutex */
THREAD_ENTER; THREAD_ENTER();
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = GET_THREAD_DATA;
BLB_put_segment(tdbb, blob, buffer, length); 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 */ /* add thread enter and thread_exit wrappers */
THREAD_ENTER; THREAD_ENTER();
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = GET_THREAD_DATA;
*return_length = BLB_get_segment(tdbb, blob, buffer, length); *return_length = BLB_get_segment(tdbb, blob, buffer, length);
THREAD_EXIT; THREAD_EXIT();
if (blob->blb_flags & BLB_eof) if (blob->blb_flags & BLB_eof)
return 0; return 0;
@ -956,9 +956,9 @@ static void invoke(UserFunction* function,
START_CHECK_FOR_EXCEPTIONS(function->fun_exception_message.c_str()); START_CHECK_FOR_EXCEPTIONS(function->fun_exception_message.c_str());
if (function->fun_return_arg) if (function->fun_return_arg)
{ {
THREAD_EXIT; THREAD_EXIT();
CALL_UDF(function->fun_entrypoint, void); CALL_UDF(function->fun_entrypoint, void);
THREAD_ENTER; THREAD_ENTER();
} }
else if ((SLONG) return_ptr->fun_mechanism == FUN_value) 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_time:
case dtype_sql_date: case dtype_sql_date:
case dtype_long: case dtype_long:
THREAD_EXIT; THREAD_EXIT();
value->vlu_misc.vlu_long = value->vlu_misc.vlu_long =
CALL_UDF(function->fun_entrypoint, SLONG); CALL_UDF(function->fun_entrypoint, SLONG);
THREAD_ENTER; THREAD_ENTER();
break; break;
case dtype_short: case dtype_short:
@ -978,10 +978,10 @@ static void invoke(UserFunction* function,
// must always be returned as a LONG. See v3.2 release notes // must always be returned as a LONG. See v3.2 release notes
// 1994-September-28 David Schnepper // 1994-September-28 David Schnepper
THREAD_EXIT; THREAD_EXIT();
value->vlu_misc.vlu_short = (SSHORT) value->vlu_misc.vlu_short = (SSHORT)
CALL_UDF(function->fun_entrypoint, SLONG); CALL_UDF(function->fun_entrypoint, SLONG);
THREAD_ENTER; THREAD_ENTER();
break; break;
case dtype_real: case dtype_real:
@ -989,27 +989,27 @@ static void invoke(UserFunction* function,
// must always be returned as a DOUBLE. See v3.2 release notes // must always be returned as a DOUBLE. See v3.2 release notes
// 1994-September-28 David Schnepper // 1994-September-28 David Schnepper
THREAD_EXIT; THREAD_EXIT();
value->vlu_misc.vlu_float = (float) value->vlu_misc.vlu_float = (float)
CALL_UDF(function->fun_entrypoint, double); CALL_UDF(function->fun_entrypoint, double);
THREAD_ENTER; THREAD_ENTER();
break; break;
case dtype_int64: case dtype_int64:
THREAD_EXIT; THREAD_EXIT();
value->vlu_misc.vlu_int64 = value->vlu_misc.vlu_int64 =
CALL_UDF(function->fun_entrypoint, SINT64); CALL_UDF(function->fun_entrypoint, SINT64);
THREAD_ENTER; THREAD_ENTER();
break; break;
case dtype_double: case dtype_double:
#ifdef VMS #ifdef VMS
case dtype_d_float: case dtype_d_float:
#endif #endif
THREAD_EXIT; THREAD_EXIT();
value->vlu_misc.vlu_double = value->vlu_misc.vlu_double =
CALL_UDF(function->fun_entrypoint, double); CALL_UDF(function->fun_entrypoint, double);
THREAD_ENTER; THREAD_ENTER();
break; break;
case dtype_timestamp: case dtype_timestamp:
@ -1020,10 +1020,10 @@ static void invoke(UserFunction* function,
} }
else else
{ {
THREAD_EXIT; THREAD_EXIT();
typedef UCHAR* pUCHAR; typedef UCHAR* pUCHAR;
temp_ptr = CALL_UDF(function->fun_entrypoint, pUCHAR); temp_ptr = CALL_UDF(function->fun_entrypoint, pUCHAR);
THREAD_ENTER; THREAD_ENTER();
if (temp_ptr != NULL) if (temp_ptr != NULL)
{ {

View File

@ -1426,7 +1426,7 @@ void ISC_exception_post(ULONG sig_num, const TEXT* err_msg)
* *
**************************************/ **************************************/
if (!SCH_thread_enter_check()) 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. // 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. // 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 ()) if (!SCH_thread_enter_check ())
{ {
THREAD_ENTER; THREAD_ENTER();
} }
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = GET_THREAD_DATA;

View File

@ -164,14 +164,14 @@ const SSHORT WAIT_PERIOD = -1;
# undef V4_JRD_MUTEX_LOCK # undef V4_JRD_MUTEX_LOCK
# undef V4_JRD_MUTEX_UNLOCK # undef V4_JRD_MUTEX_UNLOCK
# define V4_INIT THD_INIT # 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_GLOBAL_MUTEX_UNLOCK THD_GLOBAL_MUTEX_UNLOCK
# define V4_MUTEX_INIT(mutx) THD_MUTEX_INIT (mutx) # 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_UNLOCK(mutx) THD_MUTEX_UNLOCK (mutx)
# define V4_MUTEX_DESTROY(mutx) THD_MUTEX_DESTROY (mutx) # define V4_MUTEX_DESTROY(mutx) THD_MUTEX_DESTROY (mutx)
# ifndef SUPERSERVER # 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) # define V4_JRD_MUTEX_UNLOCK(mutx) THD_JRD_MUTEX_UNLOCK (mutx)
# endif /* SUPERSERVER */ # endif /* SUPERSERVER */
# endif /* V4_THREADING */ # 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_INIT_MUTEX THD_rec_mutex_init (&databases_rec_mutex)
#define JRD_SS_DESTROY_MUTEX THD_rec_mutex_destroy (&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);\ 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_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_LOCK THD_rec_mutex_lock (&databases_rec_mutex)
#define JRD_SS_THD_MUTEX_UNLOCK THD_rec_mutex_unlock (&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)) if (!(tdbb->tdbb_flags & TDBB_sweeper))
SCH_schedule(); SCH_schedule();
else { else {
THREAD_EXIT; THREAD_EXIT();
THREAD_YIELD; THREAD_YIELD();
THREAD_ENTER; THREAD_ENTER();
} }
/* If database has been shutdown then get out */ /* If database has been shutdown then get out */
@ -5406,9 +5406,9 @@ static Database* init(thread_db* tdbb,
if (!initialized) { if (!initialized) {
THD_INIT; THD_INIT;
THREAD_EXIT; THREAD_EXIT();
THD_GLOBAL_MUTEX_LOCK; THD_GLOBAL_MUTEX_LOCK;
THREAD_ENTER; THREAD_ENTER();
PluginManager::load_engine_plugins(); PluginManager::load_engine_plugins();
if (!initialized) { if (!initialized) {
#if defined(V4_THREADING) && !defined(SUPERSERVER) #if defined(V4_THREADING) && !defined(SUPERSERVER)
@ -6024,7 +6024,7 @@ TEXT* JRD_num_attachments(TEXT* const buf, USHORT buf_len, USHORT flag,
} }
#endif #endif
THREAD_ENTER; THREAD_ENTER();
/* Zip through the list of databases and count the number of local /* Zip through the list of databases and count the number of local
* connections. If buf is not NULL then copy all the database names * 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; *atts = num_att;
*dbs = num_dbs; *dbs = num_dbs;

View File

@ -37,7 +37,7 @@
* 2004.01.16 Vlad Horsun: added support for default parameters * 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 // This MUST be at the top of the file
#ifdef DARWIN #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); THD_rec_mutex_init(&dbb->dbb_sp_rec_mutex);
dbb->dbb_flags |= DBB_sp_rec_mutex_init; dbb->dbb_flags |= DBB_sp_rec_mutex_init;
} }
THREAD_EXIT; THREAD_EXIT();
if (THD_rec_mutex_lock(&dbb->dbb_sp_rec_mutex)) if (THD_rec_mutex_lock(&dbb->dbb_sp_rec_mutex))
{ {
THREAD_ENTER; THREAD_ENTER();
return NULL; return NULL;
} }
THREAD_ENTER; THREAD_ENTER();
#endif /* SUPERSERVER */ #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); THD_rec_mutex_init(&dbb->dbb_sp_rec_mutex);
dbb->dbb_flags |= DBB_sp_rec_mutex_init; dbb->dbb_flags |= DBB_sp_rec_mutex_init;
} }
THREAD_EXIT; THREAD_EXIT();
if (THD_rec_mutex_lock(&dbb->dbb_sp_rec_mutex)) { if (THD_rec_mutex_lock(&dbb->dbb_sp_rec_mutex)) {
THREAD_ENTER; THREAD_ENTER();
return; return;
} }
THREAD_ENTER; THREAD_ENTER();
#endif /* SUPERSERVER */ #endif /* SUPERSERVER */
if (relation->rel_flags & REL_scanned if (relation->rel_flags & REL_scanned

View File

@ -32,7 +32,7 @@
* Contributor(s): * 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 #ifdef SUPERSERVER
if (thread_exit) if (thread_exit)
THREAD_EXIT; THREAD_EXIT();
state_lock->beginWrite(); state_lock->beginWrite();
if (thread_exit) if (thread_exit)
THREAD_ENTER; THREAD_ENTER();
#else #else
fb_assert(!(flags & NBAK_state_in_use)); fb_assert(!(flags & NBAK_state_in_use));
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = GET_THREAD_DATA;
@ -225,10 +225,10 @@ bool BackupManager::lock_alloc_write(bool thread_exit) throw()
{ {
#ifdef SUPERSERVER #ifdef SUPERSERVER
if (thread_exit) if (thread_exit)
THREAD_EXIT; THREAD_EXIT();
alloc_lock->beginWrite(); alloc_lock->beginWrite();
if (thread_exit) if (thread_exit)
THREAD_ENTER; THREAD_ENTER();
#else #else
fb_assert(!(flags & NBAK_alloc_in_use)); fb_assert(!(flags & NBAK_alloc_in_use));
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = GET_THREAD_DATA;
@ -284,10 +284,10 @@ bool BackupManager::lock_state(bool thread_exit) throw()
return true; return true;
#ifdef SUPERSERVER #ifdef SUPERSERVER
if (thread_exit) if (thread_exit)
THREAD_EXIT; THREAD_EXIT();
state_lock->beginRead(); state_lock->beginRead();
if (thread_exit) if (thread_exit)
THREAD_ENTER; THREAD_ENTER();
#else #else
fb_assert(!(flags & NBAK_state_in_use)); fb_assert(!(flags & NBAK_state_in_use));
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() { bool BackupManager::lock_alloc(bool thread_exit) throw() {
#ifdef SUPERSERVER #ifdef SUPERSERVER
if (thread_exit) if (thread_exit)
THREAD_EXIT; THREAD_EXIT();
alloc_lock->beginRead(); alloc_lock->beginRead();
if (thread_exit) if (thread_exit)
THREAD_ENTER; THREAD_ENTER();
#else #else
fb_assert(!(flags & NBAK_alloc_in_use)); fb_assert(!(flags & NBAK_alloc_in_use));
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = GET_THREAD_DATA;

View File

@ -52,7 +52,7 @@ BOOL WINAPI DllMain(HINSTANCE h, DWORD reason, LPVOID reserved)
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
#ifdef EMBEDDED #ifdef EMBEDDED
THREAD_ENTER; THREAD_ENTER();
JRD_shutdown_all(); JRD_shutdown_all();
#endif #endif
break; break;

View File

@ -22,6 +22,11 @@
*/ */
#include "firebird.h" #include "firebird.h"
#include "../jrd/common.h"
#include "../jrd/thd.h"
#ifdef WIN_NT
#include <windows.h> // HANDLE
#endif
#include "../jrd/os/thd_priority.h" #include "../jrd/os/thd_priority.h"
#include "../common/config/config.h" #include "../common/config/config.h"
@ -33,8 +38,6 @@
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#include "../jrd/common.h"
#include "../jrd/thd_proto.h"
#include <process.h> #include <process.h>
#include <windows.h> #include <windows.h>

View File

@ -118,9 +118,9 @@ void SecurityDatabase::fini()
#ifndef EMBEDDED #ifndef EMBEDDED
if (counter == 1 && lookup_db) if (counter == 1 && lookup_db)
{ {
THREAD_EXIT; THREAD_EXIT();
isc_detach_database(status, &lookup_db); isc_detach_database(status, &lookup_db);
THREAD_ENTER; THREAD_ENTER();
} }
#endif #endif
} }
@ -155,7 +155,7 @@ bool SecurityDatabase::lookup_user(TEXT * user_name, int *uid, int *gid, TEXT *
{ {
isc_detach_database(status, &lookup_db); isc_detach_database(status, &lookup_db);
} }
THREAD_ENTER; THREAD_ENTER();
ERR_post(isc_psw_attach, 0); 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)) if (isc_start_transaction(status, &lookup_trans, 1, &lookup_db, sizeof(TPB), TPB))
{ {
THREAD_ENTER; THREAD_ENTER();
ERR_post(isc_psw_start_trans, 0); 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); isc_detach_database(status, &lookup_db);
} }
THREAD_ENTER; THREAD_ENTER();
return found; return found;
} }
@ -206,11 +206,11 @@ bool SecurityDatabase::prepare()
if (lookup_db) if (lookup_db)
{ {
THREAD_EXIT; THREAD_EXIT();
return true; return true;
} }
THREAD_EXIT; THREAD_EXIT();
lookup_db = lookup_req = 0; 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 // found there. This means that another database must be accessed, and
// that means the current context must be saved and restored. // that means the current context must be saved and restored.
THREAD_EXIT; THREAD_EXIT();
instance.mutex.aquire(); instance.mutex.aquire();
THREAD_ENTER; THREAD_ENTER();
TEXT pw1[33]; TEXT pw1[33];
const bool found = instance.lookup_user(name, uid, gid, pw1); const bool found = instance.lookup_user(name, uid, gid, pw1);
instance.mutex.release(); instance.mutex.release();

View File

@ -222,10 +222,10 @@ int QATEST_entrypoint(ULONG * function, void *arg1, void *arg2, void *arg3)
default: default:
sprintf(filename, "Unknown QATEST_entrypoint #%lu", /* TXNN */ sprintf(filename, "Unknown QATEST_entrypoint #%lu", /* TXNN */
*function); *function);
THREAD_ENTER; THREAD_ENTER();
ERR_post(isc_random, ERR_post(isc_random,
isc_arg_string, ERR_cstring(filename), 0); isc_arg_string, ERR_cstring(filename), 0);
THREAD_EXIT; THREAD_EXIT();
return 0; return 0;
} }
} }

View File

@ -494,9 +494,9 @@ static bool shutdown_locks(Database* dbb, SSHORT flag)
if (dbb->dbb_use_count) { if (dbb->dbb_use_count) {
/* Let active database threads rundown */ /* Let active database threads rundown */
THREAD_EXIT; THREAD_EXIT();
THREAD_SLEEP(1 * 1000); THREAD_SLEEP(1 * 1000);
THREAD_ENTER; THREAD_ENTER();
return false; return false;
} }

View File

@ -19,7 +19,7 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * 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 * 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 // Checkout of engine on sort I/O
THREAD_EXIT; THREAD_EXIT();
// The following is a crock induced by a VMS C bug // The following is a crock induced by a VMS C bug
@ -918,19 +918,19 @@ ULONG SORT_read_block(
const ULONG len = length; const ULONG len = length;
for (i = 0; i < IO_RETRY; i++) { for (i = 0; i < IO_RETRY; i++) {
if (lseek(sfb->sfb_file, LSEEK_OFFSET_CAST seek, SEEK_SET) == -1) { 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); SORT_error(status_vector, sfb, "lseek", isc_io_read_err, errno);
} }
if ((read_len = read(sfb->sfb_file, address, len)) == len) if ((read_len = read(sfb->sfb_file, address, len)) == len)
break; break;
else if ((SSHORT) read_len == -1 && !SYSCALL_INTERRUPTED(errno)) { else if ((SSHORT) read_len == -1 && !SYSCALL_INTERRUPTED(errno)) {
THREAD_ENTER; THREAD_ENTER();
SORT_error(status_vector, sfb, "read", isc_io_read_err, errno); SORT_error(status_vector, sfb, "read", isc_io_read_err, errno);
} }
} }
if (i == IO_RETRY) { if (i == IO_RETRY) {
THREAD_ENTER; THREAD_ENTER();
SORT_error(status_vector, sfb, "read", isc_io_read_err, errno); SORT_error(status_vector, sfb, "read", isc_io_read_err, errno);
} }
length -= read_len; length -= read_len;
@ -938,7 +938,7 @@ ULONG SORT_read_block(
seek += read_len; seek += read_len;
} }
THREAD_ENTER; THREAD_ENTER();
#ifdef DEBUG_SORT_TRACE #ifdef DEBUG_SORT_TRACE
write_trace("Read", sfb, org_seek, org_address, org_length); 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 // Check out of engine on sort I/O
THREAD_EXIT; THREAD_EXIT();
// The following is a crock induced by a VMS C bug // 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; ULONG len = length;
for (i = 0; i < IO_RETRY; i++) { for (i = 0; i < IO_RETRY; i++) {
if (lseek(sfb->sfb_file, LSEEK_OFFSET_CAST seek, SEEK_SET) == -1) { 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, SORT_error(status_vector, sfb, "lseek", isc_io_write_err,
errno); errno);
} }
@ -1221,7 +1221,7 @@ ULONG SORT_write_block(ISC_STATUS* status_vector,
write_len = write(sfb->sfb_file, address + write_len, write_len = write(sfb->sfb_file, address + write_len,
len - write_len); len - write_len);
if ((SSHORT) write_len == -1 && !SYSCALL_INTERRUPTED(errno)) { if ((SSHORT) write_len == -1 && !SYSCALL_INTERRUPTED(errno)) {
THREAD_ENTER; THREAD_ENTER();
SORT_error(status_vector, sfb, "write", isc_io_write_err, SORT_error(status_vector, sfb, "write", isc_io_write_err,
errno); errno);
} }
@ -1229,7 +1229,7 @@ ULONG SORT_write_block(ISC_STATUS* status_vector,
} }
if (i == IO_RETRY) { if (i == IO_RETRY) {
THREAD_ENTER; THREAD_ENTER();
SORT_error(status_vector, sfb, "write", isc_io_write_err, errno); SORT_error(status_vector, sfb, "write", isc_io_write_err, errno);
} }
length -= write_len; length -= write_len;
@ -1237,7 +1237,7 @@ ULONG SORT_write_block(ISC_STATUS* status_vector,
seek += write_len; seek += write_len;
} }
THREAD_ENTER; THREAD_ENTER();
return seek; return seek;
} }
@ -2643,7 +2643,7 @@ static ULONG order(sort_context* scb)
// Check out the engine // Check out the engine
THREAD_EXIT; THREAD_EXIT();
// Length of the key part of the record // Length of the key part of the record
const SSHORT length = scb->scb_longs - SIZEOF_SR_BCKPTR_IN_LONGS; 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 // Check back into the engine
THREAD_ENTER; THREAD_ENTER();
// It's OK to free this after checking back into the engine, there's // It's OK to free this after checking back into the engine, there's
// only fatal failures possible there // only fatal failures possible there
@ -2804,7 +2804,7 @@ static void sort(sort_context* scb)
// Check out the engine // Check out the engine
THREAD_EXIT; THREAD_EXIT();
// First, insert a pointer to the high key // First, insert a pointer to the high key
@ -2846,7 +2846,7 @@ static void sort(sort_context* scb)
if (!scb->scb_dup_callback) { if (!scb->scb_dup_callback) {
// Check back into the engine // Check back into the engine
THREAD_ENTER; THREAD_ENTER();
return; return;
} }
@ -2897,7 +2897,7 @@ static void sort(sort_context* scb)
// Check back into the engine // Check back into the engine
THREAD_ENTER; THREAD_ENTER();
} }
#ifdef NOT_USED_OR_REPLACED #ifdef NOT_USED_OR_REPLACED

View File

@ -139,7 +139,7 @@ using namespace Jrd;
static inline void is_service_running(const Service* service) static inline void is_service_running(const Service* service)
{ {
if (!(service->svc_flags & SVC_forked)) { if (!(service->svc_flags & SVC_forked)) {
THREAD_ENTER; THREAD_ENTER();
ERR_post (isc_svcnoexe, isc_arg_string, ERR_post (isc_svcnoexe, isc_arg_string,
service->svc_service->serv_name, 0); service->svc_service->serv_name, 0);
} }
@ -161,7 +161,7 @@ bool ck_space_for_numeric(char*& info, const char* const end)
{ {
if (info < end) if (info < end)
*info++ = isc_info_truncated; *info++ = isc_info_truncated;
THREAD_ENTER; THREAD_ENTER();
return false; return false;
} }
return true; return true;
@ -681,7 +681,7 @@ static int shutdown_thread(void *arg) {
* *
**************************************/ **************************************/
THREAD_ENTER; THREAD_ENTER();
JRD_shutdown_all(); JRD_shutdown_all();
*reinterpret_cast<int*>(arg) = 1; *reinterpret_cast<int*>(arg) = 1;
return 0; return 0;
@ -708,7 +708,7 @@ void SVC_detach(Service* service)
int flShutdownComplete = 0; int flShutdownComplete = 0;
gds__thread_start(shutdown_thread, &flShutdownComplete, gds__thread_start(shutdown_thread, &flShutdownComplete,
THREAD_medium, 0, 0); THREAD_medium, 0, 0);
THREAD_EXIT; THREAD_EXIT();
int timeout = 10; // seconds int timeout = 10; // seconds
while (timeout--) { while (timeout--) {
if (flShutdownComplete) if (flShutdownComplete)
@ -879,7 +879,7 @@ ISC_STATUS SVC_query2(Service* service,
ISC_STATUS *status; ISC_STATUS *status;
USHORT timeout; USHORT timeout;
THREAD_EXIT; THREAD_EXIT();
/* Setup the status vector */ /* Setup the status vector */
status = tdbb->tdbb_status_vector; status = tdbb->tdbb_status_vector;
@ -1003,7 +1003,7 @@ ISC_STATUS SVC_query2(Service* service,
(info = (info =
INF_put_item(isc_spb_dbname, length, ptr2, info, INF_put_item(isc_spb_dbname, length, ptr2, info,
end))) { end))) {
THREAD_ENTER; THREAD_ENTER();
return 0; return 0;
} }
ptr2 += length; ptr2 += length;
@ -1066,7 +1066,7 @@ ISC_STATUS SVC_query2(Service* service,
*/ */
info = INF_put_item(item, strlen(buffer), buffer, info, end); info = INF_put_item(item, strlen(buffer), buffer, info, end);
if (!info) { if (!info) {
THREAD_ENTER; THREAD_ENTER();
return 0; return 0;
} }
break; break;
@ -1094,9 +1094,9 @@ ISC_STATUS SVC_query2(Service* service,
case isc_info_svc_default_config: case isc_info_svc_default_config:
*info++ = item; *info++ = item;
if (service->svc_user_flag & SVC_user_dba) { if (service->svc_user_flag & SVC_user_dba) {
THREAD_ENTER; THREAD_ENTER();
// TODO: reset the config values to defaults // TODO: reset the config values to defaults
THREAD_EXIT; THREAD_EXIT();
} }
else else
need_admin_privs(&status, "isc_info_svc_default_config"); 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: case isc_info_svc_set_config:
*info++ = item; *info++ = item;
if (service->svc_user_flag & SVC_user_dba) { if (service->svc_user_flag & SVC_user_dba) {
THREAD_ENTER; THREAD_ENTER();
// TODO: set the config values // TODO: set the config values
THREAD_EXIT; THREAD_EXIT();
} }
else { else {
need_admin_privs(&status, "isc_info_svc_set_config"); 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 */ /* The version of the server engine */
info = INF_put_item(item, strlen(GDS_VERSION), GDS_VERSION, info, end); info = INF_put_item(item, strlen(GDS_VERSION), GDS_VERSION, info, end);
if (!info) { if (!info) {
THREAD_ENTER; THREAD_ENTER();
return 0; return 0;
} }
break; break;
@ -1157,7 +1157,7 @@ ISC_STATUS SVC_query2(Service* service,
0, 0, NULL); 0, 0, NULL);
info = INF_put_item(item, strlen(buffer), buffer, info, end); info = INF_put_item(item, strlen(buffer), buffer, info, end);
if (!info) { if (!info) {
THREAD_ENTER; THREAD_ENTER();
return 0; return 0;
} }
@ -1170,7 +1170,7 @@ ISC_STATUS SVC_query2(Service* service,
if (!(info = INF_put_item(item, strlen(buffer), buffer, if (!(info = INF_put_item(item, strlen(buffer), buffer,
info, end))) { info, end))) {
THREAD_ENTER; THREAD_ENTER();
return 0; return 0;
} }
break; break;
@ -1194,7 +1194,7 @@ ISC_STATUS SVC_query2(Service* service,
*info++ = isc_info_truncated; *info++ = isc_info_truncated;
l -= length; l -= length;
if (l > service->svc_resp_buf_len) { if (l > service->svc_resp_buf_len) {
THREAD_ENTER; THREAD_ENTER();
if (service->svc_resp_buf) if (service->svc_resp_buf)
gds__free((SLONG *) service->svc_resp_buf); gds__free((SLONG *) service->svc_resp_buf);
service->svc_resp_buf = (UCHAR *) gds__alloc((SLONG) l); 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 */ l = 0; /* set the length to zero */
} }
service->svc_resp_buf_len = l; service->svc_resp_buf_len = l;
THREAD_EXIT; THREAD_EXIT();
} }
service_get(service, service_get(service,
reinterpret_cast < char *>(service->svc_resp_buf), reinterpret_cast < char *>(service->svc_resp_buf),
@ -1225,7 +1225,7 @@ ISC_STATUS SVC_query2(Service* service,
(service->svc_resp_ptr), (service->svc_resp_ptr),
info, end))) info, end)))
{ {
THREAD_ENTER; THREAD_ENTER();
return 0; return 0;
} }
service->svc_resp_ptr += length; service->svc_resp_ptr += length;
@ -1243,7 +1243,7 @@ ISC_STATUS SVC_query2(Service* service,
UCHAR*>(buffer), 2); UCHAR*>(buffer), 2);
service_get(service, buffer, l, GET_BINARY, 0, &length); service_get(service, buffer, l, GET_BINARY, 0, &length);
if (!(info = INF_put_item(item, length, buffer, info, end))) { if (!(info = INF_put_item(item, length, buffer, info, end))) {
THREAD_ENTER; THREAD_ENTER();
return 0; return 0;
} }
break; break;
@ -1273,7 +1273,7 @@ ISC_STATUS SVC_query2(Service* service,
with an indication that more is available. */ with an indication that more is available. */
if (!(info = INF_put_item(item, length, info + 3, info, end))) { if (!(info = INF_put_item(item, length, info + 3, info, end))) {
THREAD_ENTER; THREAD_ENTER();
return 0; return 0;
} }
@ -1312,7 +1312,7 @@ ISC_STATUS SVC_query2(Service* service,
SVC_finish(service, SVC_finished); SVC_finish(service, SVC_finished);
} }
THREAD_ENTER; THREAD_ENTER();
return tdbb->tdbb_status_vector[1]; return tdbb->tdbb_status_vector[1];
} }
@ -1340,7 +1340,7 @@ void SVC_query(Service* service,
USHORT l, length, version, get_flags; USHORT l, length, version, get_flags;
USHORT timeout; USHORT timeout;
THREAD_EXIT; THREAD_EXIT();
/* Process the send portion of the query first. */ /* Process the send portion of the query first. */
@ -1412,7 +1412,7 @@ void SVC_query(Service* service,
info, info,
end); end);
if (!info) { if (!info) {
THREAD_ENTER; THREAD_ENTER();
return; return;
} }
length = INF_convert(num_dbs, buffer); length = INF_convert(num_dbs, buffer);
@ -1422,7 +1422,7 @@ void SVC_query(Service* service,
info, info,
end); end);
if (!info) { if (!info) {
THREAD_ENTER; THREAD_ENTER();
return; return;
} }
} }
@ -1476,7 +1476,7 @@ void SVC_query(Service* service,
*/ */
if (!(info = INF_put_item(item, strlen(PathBuffer), if (!(info = INF_put_item(item, strlen(PathBuffer),
PathBuffer, info, end))) { PathBuffer, info, end))) {
THREAD_ENTER; THREAD_ENTER();
return; return;
} }
break; break;
@ -1504,9 +1504,9 @@ void SVC_query(Service* service,
case isc_info_svc_default_config: case isc_info_svc_default_config:
*info++ = item; *info++ = item;
if (service->svc_user_flag & SVC_user_dba) { if (service->svc_user_flag & SVC_user_dba) {
THREAD_ENTER; THREAD_ENTER();
// TODO: reset the config values to defaults // TODO: reset the config values to defaults
THREAD_EXIT; THREAD_EXIT();
} }
else else
need_admin_privs(&status, "isc_info_svc_default_config"); need_admin_privs(&status, "isc_info_svc_default_config");
@ -1515,9 +1515,9 @@ void SVC_query(Service* service,
case isc_info_svc_set_config: case isc_info_svc_set_config:
*info++ = item; *info++ = item;
if (service->svc_user_flag & SVC_user_dba) { if (service->svc_user_flag & SVC_user_dba) {
THREAD_ENTER; THREAD_ENTER();
// TODO: set the config values // TODO: set the config values
THREAD_EXIT; THREAD_EXIT();
} }
else { else {
need_admin_privs(&status, "isc_info_svc_set_config"); need_admin_privs(&status, "isc_info_svc_set_config");
@ -1533,7 +1533,7 @@ void SVC_query(Service* service,
(info = (info =
INF_put_item(item, length, buffer, info, end))) INF_put_item(item, length, buffer, info, end)))
{ {
THREAD_ENTER; THREAD_ENTER();
return; return;
} }
break; break;
@ -1547,7 +1547,7 @@ void SVC_query(Service* service,
(info = (info =
INF_put_item(item, length, buffer, info, end))) INF_put_item(item, length, buffer, info, end)))
{ {
THREAD_ENTER; THREAD_ENTER();
return; return;
} }
break; break;
@ -1563,7 +1563,7 @@ void SVC_query(Service* service,
*p = *gvp; *p = *gvp;
if (!(info = INF_put_item(item, p - buffer, buffer, info, end))) if (!(info = INF_put_item(item, p - buffer, buffer, info, end)))
{ {
THREAD_ENTER; THREAD_ENTER();
return; return;
} }
break; break;
@ -1577,7 +1577,7 @@ void SVC_query(Service* service,
*p++ = IMPLEMENTATION; *p++ = IMPLEMENTATION;
if (!(info = INF_put_item(item, p - buffer, buffer, info, end))) if (!(info = INF_put_item(item, p - buffer, buffer, info, end)))
{ {
THREAD_ENTER; THREAD_ENTER();
return; return;
} }
break; break;
@ -1589,7 +1589,7 @@ void SVC_query(Service* service,
if (!(info = INF_put_item(item, strlen(buffer), buffer, info, end))) if (!(info = INF_put_item(item, strlen(buffer), buffer, info, end)))
{ {
THREAD_ENTER; THREAD_ENTER();
return; return;
} }
break; break;
@ -1614,7 +1614,7 @@ void SVC_query(Service* service,
l -= length; l -= length;
if (l > service->svc_resp_buf_len) if (l > service->svc_resp_buf_len)
{ {
THREAD_ENTER; THREAD_ENTER();
if (service->svc_resp_buf) if (service->svc_resp_buf)
gds__free((SLONG *) service->svc_resp_buf); gds__free((SLONG *) service->svc_resp_buf);
service->svc_resp_buf = (UCHAR *) gds__alloc((SLONG) l); 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 */ l = 0; /* set the length to zero */
} }
service->svc_resp_buf_len = l; service->svc_resp_buf_len = l;
THREAD_EXIT; THREAD_EXIT();
} }
service_get(service, service_get(service,
reinterpret_cast<char*>(service->svc_resp_buf), reinterpret_cast<char*>(service->svc_resp_buf),
@ -1649,7 +1649,7 @@ void SVC_query(Service* service,
info, info,
end))) end)))
{ {
THREAD_ENTER; THREAD_ENTER();
return; return;
} }
service->svc_resp_ptr += length; service->svc_resp_ptr += length;
@ -1666,7 +1666,7 @@ void SVC_query(Service* service,
service_get(service, buffer, l, GET_BINARY, 0, &length); service_get(service, buffer, l, GET_BINARY, 0, &length);
if (!(info = INF_put_item(item, length, buffer, info, end))) if (!(info = INF_put_item(item, length, buffer, info, end)))
{ {
THREAD_ENTER; THREAD_ENTER();
return; return;
} }
break; break;
@ -1714,7 +1714,7 @@ void SVC_query(Service* service,
SVC_finish(service, SVC_finished); 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 = event_t* evnt_ptr =
reinterpret_cast<event_t*> (&(service->svc_start_event)); reinterpret_cast<event_t*> (&(service->svc_start_event));
THREAD_EXIT; THREAD_EXIT();
/* create an event for the service. The event will be signaled once the /* 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 * particular service has reached a point in which it can start to return
* information to the client. This will allow isc_service_start to * 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); ISC_event_fini(evnt_ptr);
THREAD_ENTER; THREAD_ENTER();
} }
else else
{ {
@ -2233,7 +2233,7 @@ static void io_error(
#ifdef MULTI_THREAD #ifdef MULTI_THREAD
if (reenter_flag) if (reenter_flag)
THREAD_ENTER; THREAD_ENTER();
#endif #endif
ERR_post(isc_io_error, isc_arg_string, string, isc_arg_string, filename, 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 = ' '; *p = ' ';
} }
THREAD_EXIT; THREAD_EXIT();
STARTUPINFO start_crud; STARTUPINFO start_crud;
start_crud.cb = sizeof(STARTUPINFO); start_crud.cb = sizeof(STARTUPINFO);
@ -2449,7 +2449,7 @@ static void service_fork(TEXT* service_path, Service* service)
CloseHandle(pipe_output); CloseHandle(pipe_output);
CloseHandle(pipe_error); CloseHandle(pipe_error);
} }
THREAD_ENTER; THREAD_ENTER();
if (argv_data != argv_data_buf) if (argv_data != argv_data_buf)
gds__free((SLONG *) argv_data); 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: */ if (!service->svc_stdout) /* NOMEM: */
ERR_post(isc_virmemexh, 0); ERR_post(isc_virmemexh, 0);
THREAD_EXIT; THREAD_EXIT();
gds__thread_start(reinterpret_cast<FPTR_INT_VOID_PTR>(service_executable), gds__thread_start(reinterpret_cast<FPTR_INT_VOID_PTR>(service_executable),
service, 0, 0, (void*)&service->svc_handle); 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 /* At last we can fork the sub-process. If the fork succeeds, repeat
it so that we don't have defunct processes hanging around. */ it so that we don't have defunct processes hanging around. */
THREAD_EXIT; THREAD_EXIT();
int pid; int pid;
switch (pid = vfork()) { switch (pid = vfork()) {
case -1: case -1:
THREAD_ENTER; THREAD_ENTER();
if (argv != argv_buf) if (argv != argv_buf)
gds__free(argv); gds__free(argv);
if (argv_data != argv_data_buf) if (argv_data != argv_data_buf)
@ -3102,7 +3102,7 @@ static void service_fork(TEXT* service_path, Service* service)
waitpid(pid, NULL, 0); waitpid(pid, NULL, 0);
THREAD_ENTER; THREAD_ENTER();
if (argv != argv_buf) if (argv != argv_buf)
gds__free(argv); gds__free(argv);

View File

@ -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 #ifndef JRD_THD_H
@ -125,31 +125,6 @@ struct IB_RTL_CRITICAL_SECTION
#define GET_THREAD_DATA gdbb #define GET_THREAD_DATA gdbb
#endif #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) */ /* Thread priorities (may be ignored) */
const int THREAD_high = 1; const int THREAD_high = 1;
@ -233,6 +208,60 @@ typedef struct wlck_t {
const int WLCK_read = 1; const int WLCK_read = 1;
const int WLCK_write = 2; 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 */ /* Threading allocation size */
#define THREAD_STRUCT_SIZE(type,n) (n * sizeof (type) + ALIGNMENT) #define THREAD_STRUCT_SIZE(type,n) (n * sizeof (type) + ALIGNMENT)

View File

@ -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)) if (transaction && !(transaction->tra_flags & TRA_write))
return; return;
else { else {
THREAD_EXIT; THREAD_EXIT();
THREAD_ENTER; THREAD_ENTER();
tip = reinterpret_cast<tx_inv_page*>(CCH_FETCH(tdbb, &window, LCK_write, pag_transactions)); tip = reinterpret_cast<tx_inv_page*>(CCH_FETCH(tdbb, &window, LCK_write, pag_transactions));
if (generation == tip->pag_generation) if (generation == tip->pag_generation)
CCH_MARK_MUST_WRITE(tdbb, &window); CCH_MARK_MUST_WRITE(tdbb, &window);

View File

@ -1639,18 +1639,18 @@ static RTN walk_index(thread_db* tdbb,
// If the index & relation contain different sets of records we // If the index & relation contain different sets of records we
// have a corrupt index // have a corrupt index
if (control && (control->vdr_flags & vdr_records)) { if (control && (control->vdr_flags & vdr_records)) {
THREAD_EXIT; THREAD_EXIT();
next_number = -1; next_number = -1;
while (SBM_next(control->vdr_rel_records, &next_number, while (SBM_next(control->vdr_rel_records, &next_number,
RSE_get_forward)) RSE_get_forward))
{ {
if (!SBM_test(control->vdr_idx_records, next_number)) { if (!SBM_test(control->vdr_idx_records, next_number)) {
THREAD_ENTER; THREAD_ENTER();
return corrupt(tdbb, control, VAL_INDEX_MISSING_ROWS, return corrupt(tdbb, control, VAL_INDEX_MISSING_ROWS,
relation, id + 1); relation, id + 1);
} }
} }
THREAD_ENTER; THREAD_ENTER();
} }
return rtn_ok; return rtn_ok;

View File

@ -1003,9 +1003,9 @@ bool VIO_check_if_updated(thread_db* tdbb, record_param* rpb)
} }
case tra_precommitted: case tra_precommitted:
THREAD_EXIT; THREAD_EXIT();
THREAD_SLEEP(100); /* milliseconds */ THREAD_SLEEP(100); /* milliseconds */
THREAD_ENTER; THREAD_ENTER();
break; break;
case tra_limbo: case tra_limbo:
@ -1494,9 +1494,9 @@ void VIO_fini(thread_db* tdbb)
dbb->dbb_flags &= ~DBB_garbage_collector; dbb->dbb_flags &= ~DBB_garbage_collector;
ISC_event_post(dbb->dbb_gc_event); /* Wake up running thread */ 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); ISC_event_wait(1, &gc_event_fini, &count, 0, NULL, 0);
THREAD_ENTER; THREAD_ENTER();
/* Cleanup finalization event */ /* Cleanup finalization event */
ISC_event_fini(gc_event_fini); ISC_event_fini(gc_event_fini);
} }
@ -1856,9 +1856,9 @@ bool VIO_get_current(
continue; continue;
} }
else if (state == tra_precommitted) { else if (state == tra_precommitted) {
THREAD_EXIT; THREAD_EXIT();
THREAD_SLEEP(100); /* milliseconds */ THREAD_SLEEP(100); /* milliseconds */
THREAD_ENTER; THREAD_ENTER();
continue; continue;
} }
@ -1885,9 +1885,9 @@ bool VIO_get_current(
} }
if (state == tra_active) { if (state == tra_active) {
THREAD_EXIT; THREAD_EXIT();
THREAD_SLEEP(100); /* milliseconds */ THREAD_SLEEP(100); /* milliseconds */
THREAD_ENTER; THREAD_ENTER();
continue; continue;
} }
} }
@ -1980,9 +1980,9 @@ void VIO_init(thread_db* tdbb)
{ {
ERR_bugcheck_msg("cannot start thread"); ERR_bugcheck_msg("cannot start thread");
} }
THREAD_EXIT; THREAD_EXIT();
ISC_event_wait(1, &gc_event_init, &count, 10 * 1000000, NULL, 0); ISC_event_wait(1, &gc_event_init, &count, 10 * 1000000, NULL, 0);
THREAD_ENTER; THREAD_ENTER();
/* Clean up initialization event */ /* Clean up initialization event */
ISC_event_fini(gc_event_init); ISC_event_fini(gc_event_init);
} }
@ -3546,7 +3546,7 @@ static void THREAD_ROUTINE garbage_collector(Database* dbb)
* improve query response time and throughput. * improve query response time and throughput.
* *
**************************************/ **************************************/
THREAD_ENTER; THREAD_ENTER();
CHECK_DBB(dbb); CHECK_DBB(dbb);
event_t* gc_event = dbb->dbb_gc_event; event_t* gc_event = dbb->dbb_gc_event;
record_param rpb; record_param rpb;
@ -3629,9 +3629,9 @@ static void THREAD_ROUTINE garbage_collector(Database* dbb)
while (dbb->dbb_flags & DBB_suspend_bgio) { while (dbb->dbb_flags & DBB_suspend_bgio) {
count = ISC_event_clear(gc_event); count = ISC_event_clear(gc_event);
THREAD_EXIT; THREAD_EXIT();
ISC_event_wait(1, &gc_event, &count, 10 * 1000000, NULL, 0); ISC_event_wait(1, &gc_event, &count, 10 * 1000000, NULL, 0);
THREAD_ENTER; THREAD_ENTER();
if (!(dbb->dbb_flags & DBB_garbage_collector)) { if (!(dbb->dbb_flags & DBB_garbage_collector)) {
goto gc_exit; goto gc_exit;
} }
@ -3772,10 +3772,10 @@ rel_exit:
continue; continue;
} }
dbb->dbb_flags &= ~DBB_gc_active; dbb->dbb_flags &= ~DBB_gc_active;
THREAD_EXIT; THREAD_EXIT();
int timeout = ISC_event_wait(1, &gc_event, &count, int timeout = ISC_event_wait(1, &gc_event, &count,
10 * 1000000, NULL, 0); 10 * 1000000, NULL, 0);
THREAD_ENTER; THREAD_ENTER();
dbb->dbb_flags |= DBB_gc_active; dbb->dbb_flags |= DBB_gc_active;
if (!timeout) { if (!timeout) {
count = ISC_event_clear(gc_event); count = ISC_event_clear(gc_event);
@ -3814,7 +3814,7 @@ gc_exit:
ISC_event_fini(gc_event); ISC_event_fini(gc_event);
RESTORE_THREAD_DATA; RESTORE_THREAD_DATA;
THREAD_EXIT; THREAD_EXIT();
} // try } // try
catch (const std::exception&) { catch (const std::exception&) {
@ -4301,9 +4301,9 @@ static int prepare_update( thread_db* tdbb,
} }
if (state == tra_active) { if (state == tra_active) {
THREAD_EXIT; THREAD_EXIT();
THREAD_SLEEP(100); /* milliseconds */ THREAD_SLEEP(100); /* milliseconds */
THREAD_ENTER; THREAD_ENTER();
continue; continue;
} }
} }
@ -4357,9 +4357,9 @@ static int prepare_update( thread_db* tdbb,
} }
if (state == tra_precommitted) { if (state == tra_precommitted) {
THREAD_EXIT; THREAD_EXIT();
THREAD_SLEEP(100); /* milliseconds */ THREAD_SLEEP(100); /* milliseconds */
THREAD_ENTER; THREAD_ENTER();
} }
else { else {
VIO_backout(tdbb, rpb, transaction); VIO_backout(tdbb, rpb, transaction);

View File

@ -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" #include "firebird.h"
@ -6117,7 +6117,7 @@ static void subsystem_enter(void)
THD_INIT; THD_INIT;
#endif #endif
THREAD_ENTER; THREAD_ENTER();
#if !(defined REQUESTER || defined SUPERCLIENT || defined SUPERSERVER) #if !(defined REQUESTER || defined SUPERCLIENT || defined SUPERSERVER)
isc_enter_count++; isc_enter_count++;
if (subsystem_usage == 0 || if (subsystem_usage == 0 ||
@ -6166,7 +6166,7 @@ static void subsystem_exit(void)
} }
isc_enter_count--; isc_enter_count--;
#endif #endif
THREAD_EXIT; THREAD_EXIT();
} }

View File

@ -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" #include "firebird.h"
@ -4972,7 +4972,7 @@ static USHORT wait_for_request(
monopolizing the engine monopolizing the engine
*/ */
#ifdef SUPERSERVER #ifdef SUPERSERVER
THREAD_EXIT; THREAD_EXIT();
#endif #endif
AST_ENABLE; AST_ENABLE;
ret = ISC_event_wait(1, &event_ptr, &value, ret = ISC_event_wait(1, &event_ptr, &value,
@ -4980,7 +4980,7 @@ static USHORT wait_for_request(
lock_alarm_handler, event_ptr); lock_alarm_handler, event_ptr);
AST_DISABLE; AST_DISABLE;
#ifdef SUPERSERVER #ifdef SUPERSERVER
THREAD_ENTER; THREAD_ENTER();
#endif #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 The only thing we could do now is to wait. But let's do it without
monopolizing the engine monopolizing the engine
*/ */
THREAD_EXIT; THREAD_EXIT();
ret = WaitForSingleObject(owner->own_wakeup_hndl, ret = WaitForSingleObject(owner->own_wakeup_hndl,
(timeout - current_time) * 1000); (timeout - current_time) * 1000);
THREAD_ENTER; THREAD_ENTER();
#else #else
ret = WaitForSingleObject(wakeup_event[0], (timeout - current_time) * 1000); ret = WaitForSingleObject(wakeup_event[0], (timeout - current_time) * 1000);
#endif #endif

View File

@ -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 "firebird.h"
#include <stdio.h> #include <stdio.h>
@ -449,13 +449,13 @@ static bool port_mutex_inited = false;
port_mutex_inited = true; \ port_mutex_inited = true; \
THD_mutex_init (&port_mutex); \ THD_mutex_init (&port_mutex); \
} \ } \
THREAD_EXIT; \ THREAD_EXIT(); \
THD_mutex_lock (&port_mutex); \ 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); \ THD_mutex_unlock (&port_mutex); \
THREAD_ENTER THREAD_ENTER();
#endif #endif
@ -808,7 +808,7 @@ rem_port* INET_connect(const TEXT* name,
(SCHAR*) &address.sin_addr, (SCHAR*) &address.sin_addr,
sizeof(address.sin_addr)); sizeof(address.sin_addr));
THREAD_EXIT; THREAD_EXIT();
const struct servent* service = getservbyname(protocol, "tcp"); const struct servent* service = getservbyname(protocol, "tcp");
#ifdef WIN_NT #ifdef WIN_NT
@ -827,7 +827,7 @@ rem_port* INET_connect(const TEXT* name,
} }
} }
#endif /* WIN_NT */ #endif /* WIN_NT */
THREAD_ENTER; THREAD_ENTER();
/* Modification by luz (slightly modified by FSG) /* Modification by luz (slightly modified by FSG)
instead of failing here, try applying hard-wired instead of failing here, try applying hard-wired
@ -898,10 +898,10 @@ rem_port* INET_connect(const TEXT* name,
int n; int n;
if (packet) { if (packet) {
THREAD_EXIT; THREAD_EXIT();
n = connect((SOCKET) port->port_handle, n = connect((SOCKET) port->port_handle,
(struct sockaddr *) &address, sizeof(address)); (struct sockaddr *) &address, sizeof(address));
THREAD_ENTER; THREAD_ENTER();
if (n != -1 && send_full(port, packet)) if (n != -1 && send_full(port, packet))
return port; return port;
else { else {
@ -1012,12 +1012,12 @@ rem_port* INET_connect(const TEXT* name,
} }
while (true) { while (true) {
THREAD_EXIT; THREAD_EXIT();
socklen_t l = sizeof(address); socklen_t l = sizeof(address);
SOCKET s = accept((SOCKET) port->port_handle, SOCKET s = accept((SOCKET) port->port_handle,
(struct sockaddr *) &address, &l); (struct sockaddr *) &address, &l);
if (s == INVALID_SOCKET) { if (s == INVALID_SOCKET) {
THREAD_ENTER; THREAD_ENTER();
inet_error(port, "accept", isc_net_connect_err, INET_ERRNO); inet_error(port, "accept", isc_net_connect_err, INET_ERRNO);
disconnect(port); disconnect(port);
return NULL; return NULL;
@ -1028,13 +1028,13 @@ rem_port* INET_connect(const TEXT* name,
if ((flag & SRVR_debug) || !fork()) if ((flag & SRVR_debug) || !fork())
#endif #endif
{ {
THREAD_ENTER; THREAD_ENTER();
SOCLOSE((SOCKET) port->port_handle); SOCLOSE((SOCKET) port->port_handle);
port->port_handle = (HANDLE) s; port->port_handle = (HANDLE) s;
port->port_server_flags |= SRVR_server; port->port_server_flags |= SRVR_server;
return port; return port;
} }
THREAD_ENTER; THREAD_ENTER();
SOCLOSE(s); 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); (SCHAR *) & address, response->p_resp_data.cstr_length);
address.sin_family = AF_INET; address.sin_family = AF_INET;
THREAD_EXIT; THREAD_EXIT();
int status = connect(n, (struct sockaddr *) &address, sizeof(address)); int status = connect(n, (struct sockaddr *) &address, sizeof(address));
THREAD_ENTER; THREAD_ENTER();
if (status < 0) { if (status < 0) {
inet_error(port, "connect", isc_net_event_connect_err, INET_ERRNO); 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; config = (LPQUERY_SERVICE_CONFIG) buffer;
if (!QueryServiceConfig if (!QueryServiceConfig
(service, config, sizeof(buffer), &config_len)) { (service, config, sizeof(buffer), &config_len)) {
THREAD_ENTER; THREAD_ENTER();
config = (LPQUERY_SERVICE_CONFIG) ALLR_alloc(config_len); config = (LPQUERY_SERVICE_CONFIG) ALLR_alloc(config_len);
/* NOMEM: ALLR_alloc handled */ /* NOMEM: ALLR_alloc handled */
/* FREE: later in this block */ /* FREE: later in this block */
@ -2017,7 +2017,7 @@ static int fork( SOCKET old_handle, USHORT flag)
strcpy(INET_command_line, config->lpBinaryPathName); strcpy(INET_command_line, config->lpBinaryPathName);
if ((SCHAR *) config != buffer) { if ((SCHAR *) config != buffer) {
ALLR_free(config); ALLR_free(config);
THREAD_EXIT; THREAD_EXIT();
} }
CloseServiceHandle(service); CloseServiceHandle(service);
} }
@ -2099,7 +2099,7 @@ static in_addr get_host_address(const TEXT* name)
**************************************/ **************************************/
in_addr address; in_addr address;
THREAD_EXIT; THREAD_EXIT();
address.s_addr = inet_addr(name); 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; return address;
} }
@ -2627,7 +2627,7 @@ static int select_wait( rem_port* main_port, SLCT * selct)
return FALSE; return FALSE;
} }
THREAD_EXIT; THREAD_EXIT();
++selct->slct_width; ++selct->slct_width;
for (;;) for (;;)
@ -2662,7 +2662,7 @@ static int select_wait( rem_port* main_port, SLCT * selct)
#endif #endif
} }
} }
THREAD_ENTER; THREAD_ENTER();
return TRUE; return TRUE;
} }
else if (INTERRUPT_ERROR(INET_ERRNO)) else if (INTERRUPT_ERROR(INET_ERRNO))
@ -2675,7 +2675,7 @@ static int select_wait( rem_port* main_port, SLCT * selct)
break; break;
#endif #endif
else { else {
THREAD_ENTER; THREAD_ENTER();
sprintf(msg, "INET/select_wait: select failed, errno = %d", sprintf(msg, "INET/select_wait: select failed, errno = %d",
INET_ERRNO); INET_ERRNO);
gds__log(msg, 0); gds__log(msg, 0);
@ -2683,7 +2683,7 @@ static int select_wait( rem_port* main_port, SLCT * selct)
} }
} // for (;;) } // for (;;)
THREAD_ENTER; THREAD_ENTER();
} }
} }
@ -3479,7 +3479,7 @@ static int packet_receive(
FD_ZERO(&slct_fdset); FD_ZERO(&slct_fdset);
FD_SET(ph, &slct_fdset); FD_SET(ph, &slct_fdset);
THREAD_EXIT; THREAD_EXIT();
int slct_count; int slct_count;
for (;;) { for (;;) {
#if (defined WIN_NT) #if (defined WIN_NT)
@ -3499,7 +3499,7 @@ static int packet_receive(
break; break;
} }
} }
THREAD_ENTER; THREAD_ENTER();
if (slct_count == -1) if (slct_count == -1)
{ {
@ -3532,11 +3532,11 @@ static int packet_receive(
} }
#endif /* REQUESTER */ #endif /* REQUESTER */
THREAD_EXIT; THREAD_EXIT();
n = n =
recv((SOCKET) port->port_handle, recv((SOCKET) port->port_handle,
reinterpret_cast<char*>(buffer), buffer_length, 0); reinterpret_cast<char*>(buffer), buffer_length, 0);
THREAD_ENTER; THREAD_ENTER();
if (n != -1 || !INTERRUPT_ERROR(INET_ERRNO)) if (n != -1 || !INTERRUPT_ERROR(INET_ERRNO))
break; break;
} }
@ -3598,7 +3598,7 @@ static bool_t packet_send( rem_port* port, const SCHAR* buffer, SSHORT buffer_le
SSHORT length = buffer_length; SSHORT length = buffer_length;
while (length) { while (length) {
THREAD_EXIT; THREAD_EXIT();
#ifdef DEBUG #ifdef DEBUG
if (INET_trace & TRACE_operations) { if (INET_trace & TRACE_operations) {
fprintf(stdout, "Before Send\n"); 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); fflush(stdout);
} }
#endif #endif
THREAD_ENTER; THREAD_ENTER();
if (n == length) { if (n == length) {
break; 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)) if ((port->port_flags & PORT_async) && !(port->port_flags & PORT_no_oob))
{ {
THREAD_EXIT; THREAD_EXIT();
int count = 0; int count = 0;
SSHORT n; SSHORT n;
#ifdef SINIXZ #ifdef SINIXZ
@ -3689,7 +3689,7 @@ static bool_t packet_send( rem_port* port, const SCHAR* buffer, SSHORT buffer_le
} }
#endif /* HAVE_SETITIMER */ #endif /* HAVE_SETITIMER */
THREAD_ENTER; THREAD_ENTER();
if (n == -1) { if (n == -1) {
return inet_error(port, "send/oob", isc_net_write_err, INET_ERRNO); return inet_error(port, "send/oob", isc_net_write_err, INET_ERRNO);
} }

View File

@ -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 "firebird.h"
#include <stdio.h> #include <stdio.h>
@ -339,10 +339,10 @@ int CLIB_ROUTINE server_main( int argc, char** argv)
} }
{ // scope block { // scope block
ISC_STATUS_ARRAY status_vector; ISC_STATUS_ARRAY status_vector;
THREAD_ENTER; THREAD_ENTER();
port = INET_connect(protocol, 0, status_vector, INET_SERVER_flag, port = INET_connect(protocol, 0, status_vector, INET_SERVER_flag,
0, 0); 0, 0);
THREAD_EXIT; THREAD_EXIT();
if (!port) { if (!port) {
gds__print_status(status_vector); gds__print_status(status_vector);
exit(STARTUP_ERROR); exit(STARTUP_ERROR);
@ -353,9 +353,9 @@ int CLIB_ROUTINE server_main( int argc, char** argv)
#ifdef VMS #ifdef VMS
channel = assign("SYS$INPUT"); channel = assign("SYS$INPUT");
#endif #endif
THREAD_ENTER; THREAD_ENTER();
port = INET_server(channel); port = INET_server(channel);
THREAD_EXIT; THREAD_EXIT();
if (!port) { if (!port) {
fprintf(stderr, "fbserver: Unable to start INET_server\n"); fprintf(stderr, "fbserver: Unable to start INET_server\n");
exit(STARTUP_ERROR); exit(STARTUP_ERROR);

View File

@ -5522,9 +5522,9 @@ static void THREAD_ROUTINE event_thread( rem_port* port)
/* read what should be an event message */ /* read what should be an event message */
THREAD_ENTER; THREAD_ENTER();
rem_port* stuff = port->receive(&packet); rem_port* stuff = port->receive(&packet);
THREAD_EXIT; THREAD_EXIT();
const P_OP operation = packet.p_operation; const P_OP operation = packet.p_operation;
@ -5542,9 +5542,9 @@ static void THREAD_ROUTINE event_thread( rem_port* port)
if (operation == op_event) { if (operation == op_event) {
P_EVENT* pevent = &packet.p_event; P_EVENT* pevent = &packet.p_event;
THREAD_ENTER; THREAD_ENTER();
RVNT event = find_event(port, pevent->p_event_rid); RVNT event = find_event(port, pevent->p_event_rid);
THREAD_EXIT; THREAD_EXIT();
if (event) { if (event) {
/* Call the asynchronous event routine associated /* Call the asynchronous event routine associated
@ -6992,9 +6992,9 @@ static void send_cancel_event(RVNT event)
if (event->rvnt_id) if (event->rvnt_id)
{ {
THREAD_EXIT; THREAD_EXIT();
(*event->rvnt_ast)(event->rvnt_arg, (USHORT) 0, NULL); (*event->rvnt_ast)(event->rvnt_arg, (USHORT) 0, NULL);
THREAD_ENTER; THREAD_ENTER();
event->rvnt_id = 0; event->rvnt_id = 0;
} }
} }
@ -7084,7 +7084,7 @@ static void server_death(rem_port* port)
* Cleanup events. * Cleanup events.
* *
**************************************/ **************************************/
THREAD_ENTER; THREAD_ENTER();
RDB rdb = port->port_context; RDB rdb = port->port_context;
if (!(port->port_flags & PORT_disconnect)) if (!(port->port_flags & PORT_disconnect))
@ -7093,16 +7093,16 @@ static void server_death(rem_port* port)
{ {
if (event->rvnt_id) if (event->rvnt_id)
{ {
THREAD_EXIT; THREAD_EXIT();
(*event->rvnt_ast) (event->rvnt_arg, (USHORT) 0, NULL); (*event->rvnt_ast) (event->rvnt_arg, (USHORT) 0, NULL);
THREAD_ENTER; THREAD_ENTER();
event->rvnt_id = 0; event->rvnt_id = 0;
} }
} }
} }
port->disconnect(); port->disconnect();
THREAD_EXIT; THREAD_EXIT();
} }
#endif #endif

View File

@ -90,12 +90,12 @@ void *CNTL_insert_thread(void)
* Functional description * Functional description
* *
**************************************/ **************************************/
THREAD_ENTER; THREAD_ENTER();
THREAD new_thread = (THREAD) ALLR_alloc((SLONG) sizeof(struct thread)); THREAD new_thread = (THREAD) ALLR_alloc((SLONG) sizeof(struct thread));
/* NOMEM: ALLR_alloc() handled */ /* NOMEM: ALLR_alloc() handled */
/* FREE: in CTRL_remove_thread() */ /* FREE: in CTRL_remove_thread() */
THREAD_EXIT; THREAD_EXIT();
DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), DuplicateHandle(GetCurrentProcess(), GetCurrentThread(),
GetCurrentProcess(), &new_thread->thread_handle, 0, FALSE, GetCurrentProcess(), &new_thread->thread_handle, 0, FALSE,
DUPLICATE_SAME_ACCESS); DUPLICATE_SAME_ACCESS);
@ -220,9 +220,9 @@ void CNTL_remove_thread( void *thread)
THREAD this_thread = (THREAD) thread; THREAD this_thread = (THREAD) thread;
CloseHandle(this_thread->thread_handle); CloseHandle(this_thread->thread_handle);
THREAD_ENTER; THREAD_ENTER();
ALLR_free(thread); ALLR_free(thread);
THREAD_EXIT; THREAD_EXIT();
} }
@ -355,7 +355,7 @@ static int cleanup_thread(void *lpv)
} }
THREAD_ENTER; THREAD_ENTER();
JRD_shutdown_all(); JRD_shutdown_all();
/* There is no THREAD_EXIT to help ensure that no /* There is no THREAD_EXIT to help ensure that no

View File

@ -240,14 +240,14 @@ int WINAPI WinMain(HINSTANCE hThisInst,
} }
if (connection_handle != INVALID_HANDLE_VALUE) { if (connection_handle != INVALID_HANDLE_VALUE) {
THREAD_ENTER; THREAD_ENTER();
if (server_flag & SRVR_inet) if (server_flag & SRVR_inet)
port = INET_reconnect(connection_handle, status_vector); port = INET_reconnect(connection_handle, status_vector);
else if (server_flag & SRVR_wnet) else if (server_flag & SRVR_wnet)
port = WNET_reconnect(connection_handle, status_vector); port = WNET_reconnect(connection_handle, status_vector);
else if (server_flag & SRVR_xnet) else if (server_flag & SRVR_xnet)
port = XNET_reconnect((ULONG) connection_handle, status_vector); port = XNET_reconnect((ULONG) connection_handle, status_vector);
THREAD_EXIT; THREAD_EXIT();
if (port) { if (port) {
service_connection(port); service_connection(port);
} }
@ -295,7 +295,7 @@ int WINAPI WinMain(HINSTANCE hThisInst,
HANDLE hEvent = HANDLE hEvent =
ISC_make_signal(TRUE, TRUE, GetCurrentProcessId(), SIGSHUT); ISC_make_signal(TRUE, TRUE, GetCurrentProcessId(), SIGSHUT);
WaitForSingleObject(hEvent, INFINITE); WaitForSingleObject(hEvent, INFINITE);
THREAD_ENTER; THREAD_ENTER();
JRD_shutdown_all(); JRD_shutdown_all();
} }
} }
@ -360,9 +360,9 @@ static void THREAD_ROUTINE inet_connect_wait_thread( void* dummy)
if (!(server_flag & SRVR_non_service)) if (!(server_flag & SRVR_non_service))
thread = CNTL_insert_thread(); thread = CNTL_insert_thread();
THREAD_ENTER; THREAD_ENTER();
port = INET_connect(protocol_inet, 0, status_vector, server_flag, 0, 0); port = INET_connect(protocol_inet, 0, status_vector, server_flag, 0, 0);
THREAD_EXIT; THREAD_EXIT();
if (port) if (port)
SRVR_multi_thread(port, server_flag); SRVR_multi_thread(port, server_flag);
else else
@ -393,9 +393,9 @@ static void THREAD_ROUTINE wnet_connect_wait_thread( void *dummy)
while (true) while (true)
{ {
THREAD_ENTER; THREAD_ENTER();
rem_port* port = WNET_connect(protocol_wnet, 0, status_vector, server_flag); rem_port* port = WNET_connect(protocol_wnet, 0, status_vector, server_flag);
THREAD_EXIT; THREAD_EXIT();
if (!port) { if (!port) {
if (status_vector[1] != isc_io_error || if (status_vector[1] != isc_io_error ||
status_vector[6] != isc_arg_win32 || 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)) if (!(server_flag & SRVR_non_service))
thread = CNTL_insert_thread(); thread = CNTL_insert_thread();
THREAD_ENTER; THREAD_ENTER();
XNET_srv(server_flag); XNET_srv(server_flag);
THREAD_EXIT; THREAD_EXIT();
if (!(server_flag & SRVR_non_service)) if (!(server_flag & SRVR_non_service))
CNTL_remove_thread(thread); CNTL_remove_thread(thread);

View File

@ -261,7 +261,7 @@ LRESULT CALLBACK WindowFunc(HWND hWnd,
#ifdef DEV_BUILD #ifdef DEV_BUILD
gds_alloc_report(ALLOC_verbose, "from server", 0); gds_alloc_report(ALLOC_verbose, "from server", 0);
#endif #endif
THREAD_ENTER; THREAD_ENTER();
JRD_shutdown_all(); JRD_shutdown_all();
DestroyWindow(hWnd); DestroyWindow(hWnd);

View File

@ -82,7 +82,7 @@ void SRVR_WinMain(
PACKET send, receive; PACKET send, receive;
zap_packet(&receive); zap_packet(&receive);
zap_packet(&send); zap_packet(&send);
THREAD_ENTER; THREAD_ENTER();
set_server(main_port, flags); set_server(main_port, flags);
if (WSASetBlockingHook((FARPROC) BlockingHook)) { if (WSASetBlockingHook((FARPROC) BlockingHook)) {
@ -120,7 +120,7 @@ void SRVR_WinMain(
} }
} }
THREAD_EXIT; THREAD_EXIT();
} }

View File

@ -358,7 +358,7 @@ rem_port* WNET_connect(const TEXT* name,
if (packet) if (packet)
{ {
THREAD_EXIT; THREAD_EXIT();
while (true) { while (true) {
port->port_handle = CreateFile(port->port_connection->str_data, port->port_handle = CreateFile(port->port_connection->str_data,
GENERIC_WRITE | GENERIC_READ, GENERIC_WRITE | GENERIC_READ,
@ -368,14 +368,14 @@ rem_port* WNET_connect(const TEXT* name,
} }
const ISC_STATUS status = GetLastError(); const ISC_STATUS status = GetLastError();
if (status != ERROR_PIPE_BUSY) { if (status != ERROR_PIPE_BUSY) {
THREAD_ENTER; THREAD_ENTER();
wnet_error(port, "CreateFile", isc_net_connect_err, status); wnet_error(port, "CreateFile", isc_net_connect_err, status);
disconnect(port); disconnect(port);
return NULL; return NULL;
} }
WaitNamedPipe(port->port_connection->str_data, 3000L); WaitNamedPipe(port->port_connection->str_data, 3000L);
} }
THREAD_ENTER; THREAD_ENTER();
send_full(port, packet); send_full(port, packet);
return port; return port;
} }
@ -385,7 +385,7 @@ rem_port* WNET_connect(const TEXT* name,
LPSECURITY_ATTRIBUTES security_attr; LPSECURITY_ATTRIBUTES security_attr;
security_attr = ISC_get_security_desc(); security_attr = ISC_get_security_desc();
THREAD_EXIT; THREAD_EXIT();
TEXT command_line[MAXPATHLEN + 32]; TEXT command_line[MAXPATHLEN + 32];
command_line[0] = 0; command_line[0] = 0;
TEXT* p = 0; TEXT* p = 0;
@ -407,7 +407,7 @@ rem_port* WNET_connect(const TEXT* name,
// TMN: The check for GetLastError() is redundant. // TMN: The check for GetLastError() is redundant.
// This code should NEVER be called if not running on NT, // This code should NEVER be called if not running on NT,
// since Win9x does not support the server side of named pipes! // since Win9x does not support the server side of named pipes!
THREAD_ENTER; THREAD_ENTER();
wnet_error(port, "CreateNamedPipe", isc_net_connect_listen_err, wnet_error(port, "CreateNamedPipe", isc_net_connect_listen_err,
ERRNO); ERRNO);
disconnect(port); disconnect(port);
@ -417,7 +417,7 @@ rem_port* WNET_connect(const TEXT* name,
if (!ConnectNamedPipe(port->port_handle, 0) && if (!ConnectNamedPipe(port->port_handle, 0) &&
GetLastError() != ERROR_PIPE_CONNECTED) GetLastError() != ERROR_PIPE_CONNECTED)
{ {
THREAD_ENTER; THREAD_ENTER();
wnet_error(port, "ConnectNamedPipe", isc_net_connect_err, ERRNO); wnet_error(port, "ConnectNamedPipe", isc_net_connect_err, ERRNO);
disconnect(port); disconnect(port);
return NULL; return NULL;
@ -425,7 +425,7 @@ rem_port* WNET_connect(const TEXT* name,
if (flag & (SRVR_debug | SRVR_multi_client)) if (flag & (SRVR_debug | SRVR_multi_client))
{ {
THREAD_ENTER; THREAD_ENTER();
port->port_server_flags |= SRVR_server; port->port_server_flags |= SRVR_server;
if (flag & SRVR_multi_client) if (flag & SRVR_multi_client)
{ {
@ -458,7 +458,7 @@ rem_port* WNET_connect(const TEXT* name,
config = (LPQUERY_SERVICE_CONFIG) buffer; config = (LPQUERY_SERVICE_CONFIG) buffer;
if (!QueryServiceConfig if (!QueryServiceConfig
(service, config, sizeof(buffer), &config_len)) { (service, config, sizeof(buffer), &config_len)) {
THREAD_ENTER; THREAD_ENTER();
config = (LPQUERY_SERVICE_CONFIG) ALLR_alloc(config_len); config = (LPQUERY_SERVICE_CONFIG) ALLR_alloc(config_len);
/* NOMEM: handled by ALLR_alloc, FREE: in this block */ /* NOMEM: handled by ALLR_alloc, FREE: in this block */
QueryServiceConfig(service, config, config_len, QueryServiceConfig(service, config, config_len,
@ -467,7 +467,7 @@ rem_port* WNET_connect(const TEXT* name,
sprintf(command_line, "%s -s", config->lpBinaryPathName); sprintf(command_line, "%s -s", config->lpBinaryPathName);
if ((SCHAR *) config != buffer) { if ((SCHAR *) config != buffer) {
ALLR_free(config); ALLR_free(config);
THREAD_EXIT; THREAD_EXIT();
} }
CloseServiceHandle(service); CloseServiceHandle(service);
} }
@ -773,7 +773,7 @@ static rem_port* aux_connect( rem_port* port, PACKET* packet, t_event_ast ast)
new_port->port_connection = new_port->port_connection =
make_pipe_name(port->port_connection->str_data, EVENT_PIPE_SUFFIX, p); make_pipe_name(port->port_connection->str_data, EVENT_PIPE_SUFFIX, p);
THREAD_EXIT; THREAD_EXIT();
while (true) { while (true) {
new_port->port_handle = new_port->port_handle =
CreateFile(new_port->port_connection->str_data, GENERIC_READ, 0, 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; break;
const ISC_STATUS status = GetLastError(); const ISC_STATUS status = GetLastError();
if (status != ERROR_PIPE_BUSY) { if (status != ERROR_PIPE_BUSY) {
THREAD_ENTER; THREAD_ENTER();
return (rem_port*) wnet_error(new_port, "CreateFile", return (rem_port*) wnet_error(new_port, "CreateFile",
isc_net_event_connect_err, status); isc_net_event_connect_err, status);
} }
WaitNamedPipe(new_port->port_connection->str_data, 3000L); WaitNamedPipe(new_port->port_connection->str_data, 3000L);
} }
THREAD_ENTER; THREAD_ENTER();
new_port->port_flags = port->port_flags & PORT_no_oob; 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); make_pipe_name(vport->port_connection->str_data, EVENT_PIPE_SUFFIX, str_pid);
LPSECURITY_ATTRIBUTES security_attr = ISC_get_security_desc(); LPSECURITY_ATTRIBUTES security_attr = ISC_get_security_desc();
THREAD_EXIT; THREAD_EXIT();
new_port->port_handle = new_port->port_handle =
CreateNamedPipe(new_port->port_connection->str_data, CreateNamedPipe(new_port->port_connection->str_data,
PIPE_ACCESS_DUPLEX, PIPE_ACCESS_DUPLEX,
@ -837,7 +837,7 @@ static rem_port* aux_request( rem_port* vport, PACKET* packet)
MAX_DATA, MAX_DATA,
0, 0,
security_attr); security_attr);
THREAD_ENTER; THREAD_ENTER();
if (new_port->port_handle == INVALID_HANDLE_VALUE) { if (new_port->port_handle == INVALID_HANDLE_VALUE) {
wnet_error(new_port, "CreateNamedPipe", isc_net_event_listen_err, wnet_error(new_port, "CreateNamedPipe", isc_net_event_listen_err,
ERRNO); ERRNO);
@ -1617,10 +1617,10 @@ static int packet_receive(
**************************************/ **************************************/
DWORD n = 0; DWORD n = 0;
THREAD_EXIT; THREAD_EXIT();
const USHORT status = const USHORT status =
ReadFile(port->port_handle, buffer, buffer_length, &n, NULL); ReadFile(port->port_handle, buffer, buffer_length, &n, NULL);
THREAD_ENTER; THREAD_ENTER();
if (!status && GetLastError() != ERROR_BROKEN_PIPE) if (!status && GetLastError() != ERROR_BROKEN_PIPE)
return wnet_error(port, "ReadFile", isc_net_read_err, ERRNO); return wnet_error(port, "ReadFile", isc_net_read_err, ERRNO);
if (!n) if (!n)
@ -1653,10 +1653,10 @@ static int packet_send( rem_port* port, const SCHAR* buffer, SSHORT buffer_lengt
const SCHAR* data = buffer; const SCHAR* data = buffer;
const DWORD length = buffer_length; const DWORD length = buffer_length;
THREAD_EXIT; THREAD_EXIT();
DWORD n; DWORD n;
const USHORT status = WriteFile(port->port_handle, data, length, &n, NULL); const USHORT status = WriteFile(port->port_handle, data, length, &n, NULL);
THREAD_ENTER; THREAD_ENTER();
if (!status) if (!status)
return wnet_error(port, "WriteFile", isc_net_write_err, ERRNO); return wnet_error(port, "WriteFile", isc_net_write_err, ERRNO);
if (n != length) if (n != length)

View File

@ -228,7 +228,7 @@ void SRVR_main(rem_port* main_port, USHORT flags)
PACKET send, receive; PACKET send, receive;
zap_packet(&receive, true); zap_packet(&receive, true);
zap_packet(&send, true); zap_packet(&send, true);
THREAD_ENTER; THREAD_ENTER();
set_server(main_port, flags); set_server(main_port, flags);
while (true) 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); gds__thread_enable(-1);
THREAD_ENTER; THREAD_ENTER();
SET_THREAD_DATA; SET_THREAD_DATA;
trdb->trdb_status_vector = status_vector; 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 and hope another thread will free memory or
request blocks that we can then use. */ request blocks that we can then use. */
THREAD_EXIT; THREAD_EXIT();
THREAD_SLEEP(1 * 1000); THREAD_SLEEP(1 * 1000);
THREAD_ENTER; THREAD_ENTER();
continue; continue;
} }
} }
@ -352,7 +352,7 @@ void SRVR_multi_thread( rem_port* main_port, USHORT flags)
if (!(port = main_port->receive(&request->req_receive))) if (!(port = main_port->receive(&request->req_receive)))
{ {
gds__log("SRVR_multi_thread/RECEIVE: error on main_port, shutting down"); gds__log("SRVR_multi_thread/RECEIVE: error on main_port, shutting down");
THREAD_EXIT; THREAD_EXIT();
RESTORE_THREAD_DATA; RESTORE_THREAD_DATA;
return; return;
} }
@ -463,7 +463,7 @@ void SRVR_multi_thread( rem_port* main_port, USHORT flags)
} }
/* We should never get to this point */ /* We should never get to this point */
THREAD_EXIT; THREAD_EXIT();
} // try } // try
catch (const std::exception&) 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"); gds__log("SRVR_multi_thread: error during startup, shutting down");
RESTORE_THREAD_DATA; RESTORE_THREAD_DATA;
THREAD_EXIT; THREAD_EXIT();
return; return;
} }
@ -651,9 +651,9 @@ static ISC_STATUS allocate_statement( rem_port* port, P_RLSE * allocate, PACKET*
RDB rdb = port->port_context; RDB rdb = port->port_context;
FB_API_HANDLE handle = 0; FB_API_HANDLE handle = 0;
THREAD_EXIT; THREAD_EXIT();
GDS_DSQL_ALLOCATE(status_vector, &rdb->rdb_handle, &handle); GDS_DSQL_ALLOCATE(status_vector, &rdb->rdb_handle, &handle);
THREAD_ENTER; THREAD_ENTER();
OBJCT object; OBJCT object;
if (status_vector[1]) if (status_vector[1])
@ -672,9 +672,9 @@ static ISC_STATUS allocate_statement( rem_port* port, P_RLSE * allocate, PACKET*
} }
else { else {
object = 0; object = 0;
THREAD_EXIT; THREAD_EXIT();
GDS_DSQL_FREE(status_vector, &statement->rsr_handle, DSQL_drop); GDS_DSQL_FREE(status_vector, &statement->rsr_handle, DSQL_drop);
THREAD_ENTER; THREAD_ENTER();
ALLR_release(statement); ALLR_release(statement);
status_vector[0] = isc_arg_gds; status_vector[0] = isc_arg_gds;
status_vector[1] = isc_too_many_handles; 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. */ they will be stuffed in the DPB if so. */
REMOTE_get_timeout_params(port, dpb, dl); REMOTE_get_timeout_params(port, dpb, dl);
THREAD_EXIT; THREAD_EXIT();
if (operation == op_attach) if (operation == op_attach)
{ {
isc_attach_database(status_vector, l, file, isc_attach_database(status_vector, l, file,
@ -799,7 +799,7 @@ static ISC_STATUS attach_database(
isc_create_database(status_vector, l, file, isc_create_database(status_vector, l, file,
&handle, dl, reinterpret_cast<const char*>(dpb), 0); &handle, dl, reinterpret_cast<const char*>(dpb), 0);
} }
THREAD_ENTER; THREAD_ENTER();
if (new_dpb != new_dpb_buffer) { if (new_dpb != new_dpb_buffer) {
ALLR_free(new_dpb); ALLR_free(new_dpb);
@ -932,9 +932,9 @@ static ISC_STATUS cancel_events( rem_port* port, P_EVENT * stuff, PACKET* send)
/* cancel the event */ /* cancel the event */
if (event->rvnt_id) { if (event->rvnt_id) {
THREAD_EXIT; THREAD_EXIT();
isc_cancel_events(status_vector, &rdb->rdb_handle, &event->rvnt_id); isc_cancel_events(status_vector, &rdb->rdb_handle, &event->rvnt_id);
THREAD_ENTER; THREAD_ENTER();
} }
/* zero event info */ /* zero event info */
@ -975,11 +975,11 @@ static void cancel_operation( rem_port* port)
{ {
if (!(rdb->rdb_flags & RDB_service)) if (!(rdb->rdb_flags & RDB_service))
{ {
THREAD_EXIT; THREAD_EXIT();
ISC_STATUS_ARRAY status_vector; ISC_STATUS_ARRAY status_vector;
gds__cancel_operation(status_vector, (FB_API_HANDLE*) &rdb->rdb_handle, gds__cancel_operation(status_vector, (FB_API_HANDLE*) &rdb->rdb_handle,
CANCEL_raise); CANCEL_raise);
THREAD_ENTER; THREAD_ENTER();
} }
} }
} }
@ -1027,7 +1027,7 @@ static USHORT check_statement_type( RSR statement)
USHORT ret = STMT_OTHER; USHORT ret = STMT_OTHER;
bool done = false; bool done = false;
THREAD_EXIT; THREAD_EXIT();
if (!GDS_DSQL_SQL_INFO(local_status, &statement->rsr_handle, if (!GDS_DSQL_SQL_INFO(local_status, &statement->rsr_handle,
sizeof(sql_info), (const SCHAR*) sql_info, sizeof(sql_info), (const SCHAR*) sql_info,
sizeof(buffer), reinterpret_cast<char*>(buffer))) sizeof(buffer), reinterpret_cast<char*>(buffer)))
@ -1059,7 +1059,7 @@ static USHORT check_statement_type( RSR statement)
info += 3 + l; info += 3 + l;
} }
} }
THREAD_ENTER; THREAD_ENTER();
return ret; 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; const UCHAR* blr = compileL->p_cmpl_blr.cstr_address;
USHORT blr_length = compileL->p_cmpl_blr.cstr_length; USHORT blr_length = compileL->p_cmpl_blr.cstr_length;
THREAD_EXIT; THREAD_EXIT();
isc_compile_request(status_vector, &rdb->rdb_handle, &handle, blr_length, isc_compile_request(status_vector, &rdb->rdb_handle, &handle, blr_length,
reinterpret_cast<const char*>(blr)); reinterpret_cast<const char*>(blr));
THREAD_ENTER; THREAD_ENTER();
if (status_vector[1]) if (status_vector[1])
return this->send_response(sendL, 0, 0, status_vector); 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; rdb->rdb_requests = requestL;
} }
else { else {
THREAD_EXIT; THREAD_EXIT();
isc_release_request(status_vector, &requestL->rrq_handle); isc_release_request(status_vector, &requestL->rrq_handle);
THREAD_ENTER; THREAD_ENTER();
ALLR_release(requestL); ALLR_release(requestL);
status_vector[0] = isc_arg_gds; status_vector[0] = isc_arg_gds;
status_vector[1] = isc_too_many_handles; 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 UCHAR* blr = ddlL->p_ddl_blr.cstr_address;
const USHORT blr_length = ddlL->p_ddl_blr.cstr_length; const USHORT blr_length = ddlL->p_ddl_blr.cstr_length;
THREAD_EXIT; THREAD_EXIT();
isc_ddl(status_vector, &rdb->rdb_handle, &transaction->rtr_handle, isc_ddl(status_vector, &rdb->rdb_handle, &transaction->rtr_handle,
blr_length, reinterpret_cast<const char*>(blr)); blr_length, reinterpret_cast<const char*>(blr));
THREAD_ENTER; THREAD_ENTER();
return this->send_response(sendL, 0, 0, status_vector); 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 /* Prevent a pending or spurious cancel from aborting
a good, clean detach from the database. */ a good, clean detach from the database. */
THREAD_EXIT; THREAD_EXIT();
gds__cancel_operation(status_vector, (FB_API_HANDLE*) &rdb->rdb_handle, gds__cancel_operation(status_vector, (FB_API_HANDLE*) &rdb->rdb_handle,
CANCEL_disable); CANCEL_disable);
THREAD_ENTER; THREAD_ENTER();
#endif #endif
while (rdb->rdb_requests) while (rdb->rdb_requests)
release_request(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); release_sql_request(rdb->rdb_sql_requests);
RTR transaction; RTR transaction;
while (transaction = rdb->rdb_transactions) { while (transaction = rdb->rdb_transactions) {
THREAD_EXIT; THREAD_EXIT();
if (!(transaction->rtr_flags & RTR_limbo)) if (!(transaction->rtr_flags & RTR_limbo))
isc_rollback_transaction(status_vector, isc_rollback_transaction(status_vector,
&transaction->rtr_handle); &transaction->rtr_handle);
@ -1258,12 +1258,12 @@ void rem_port::disconnect(PACKET* sendL, PACKET* receiveL)
gds__handle_cleanup(status_vector, gds__handle_cleanup(status_vector,
(FB_API_HANDLE*) &transaction->rtr_handle); (FB_API_HANDLE*) &transaction->rtr_handle);
#endif #endif
THREAD_ENTER; THREAD_ENTER();
release_transaction(rdb->rdb_transactions); release_transaction(rdb->rdb_transactions);
} }
THREAD_EXIT; THREAD_EXIT();
isc_detach_database(status_vector, &rdb->rdb_handle); isc_detach_database(status_vector, &rdb->rdb_handle);
THREAD_ENTER; THREAD_ENTER();
while (rdb->rdb_events) { while (rdb->rdb_events) {
release_event(rdb->rdb_events); release_event(rdb->rdb_events);
} }
@ -1273,9 +1273,9 @@ void rem_port::disconnect(PACKET* sendL, PACKET* receiveL)
} }
else else
{ {
THREAD_EXIT; THREAD_EXIT();
isc_service_detach(status_vector, &rdb->rdb_handle); isc_service_detach(status_vector, &rdb->rdb_handle);
THREAD_ENTER; THREAD_ENTER();
} }
REMOTE_free_packet(this, sendL); REMOTE_free_packet(this, sendL);
@ -1360,9 +1360,9 @@ void rem_port::drop_database(P_RLSE* release, PACKET* sendL)
RDB rdb = this->port_context; RDB rdb = this->port_context;
THREAD_EXIT; THREAD_EXIT();
isc_drop_database(status_vector, &rdb->rdb_handle); isc_drop_database(status_vector, &rdb->rdb_handle);
THREAD_ENTER; THREAD_ENTER();
if (status_vector[1] if (status_vector[1]
&& (status_vector[1] != isc_drdb_completed_with_errs)) && (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, release->p_rlse_object,
isc_bad_segstr_handle); isc_bad_segstr_handle);
THREAD_EXIT; THREAD_EXIT();
if (operation == op_close_blob) if (operation == op_close_blob)
isc_close_blob(status_vector, &blob->rbl_handle); isc_close_blob(status_vector, &blob->rbl_handle);
else else
isc_cancel_blob(status_vector, &blob->rbl_handle); isc_cancel_blob(status_vector, &blob->rbl_handle);
THREAD_ENTER; THREAD_ENTER();
if (!status_vector[1]) { if (!status_vector[1]) {
release_blob(blob); release_blob(blob);
@ -1472,9 +1472,9 @@ ISC_STATUS rem_port::end_database(P_RLSE * release, PACKET* sendL)
RDB rdb = this->port_context; RDB rdb = this->port_context;
THREAD_EXIT; THREAD_EXIT();
isc_detach_database(status_vector,&rdb->rdb_handle); isc_detach_database(status_vector,&rdb->rdb_handle);
THREAD_ENTER; THREAD_ENTER();
if (status_vector[1]) if (status_vector[1])
return this->send_response(sendL, 0, 0, status_vector); 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, release->p_rlse_object,
isc_bad_req_handle); isc_bad_req_handle);
THREAD_EXIT; THREAD_EXIT();
isc_release_request(status_vector, &requestL->rrq_handle); isc_release_request(status_vector, &requestL->rrq_handle);
THREAD_ENTER; THREAD_ENTER();
if (!status_vector[1]) if (!status_vector[1])
release_request(requestL); release_request(requestL);
@ -1551,11 +1551,11 @@ ISC_STATUS rem_port::end_statement(P_SQLFREE* free_stmt, PACKET* sendL)
free_stmt->p_sqlfree_statement, free_stmt->p_sqlfree_statement,
isc_bad_req_handle); isc_bad_req_handle);
THREAD_EXIT; THREAD_EXIT();
GDS_DSQL_FREE(status_vector, GDS_DSQL_FREE(status_vector,
&statement->rsr_handle, &statement->rsr_handle,
free_stmt->p_sqlfree_option); free_stmt->p_sqlfree_option);
THREAD_ENTER; THREAD_ENTER();
if (status_vector[1]) if (status_vector[1])
return this->send_response(sendL, 0, 0, status_vector); 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, release->p_rlse_object,
isc_bad_trans_handle); isc_bad_trans_handle);
THREAD_EXIT; THREAD_EXIT();
switch (operation) switch (operation)
{ {
case op_commit: 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; transaction->rtr_flags |= RTR_limbo;
break; break;
} }
THREAD_ENTER; THREAD_ENTER();
if (!status_vector[1]) if (!status_vector[1])
if (operation == op_commit || operation == op_rollback) { 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; parser_version = (this->port_protocol < PROTOCOL_VERSION10) ? 1 : 2;
THREAD_EXIT; THREAD_EXIT();
GDS_DSQL_EXECUTE_IMMED(status_vector, GDS_DSQL_EXECUTE_IMMED(status_vector,
&rdb->rdb_handle, &rdb->rdb_handle,
&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_type,
out_msg_length, out_msg_length,
reinterpret_cast<char*>(out_msg)); reinterpret_cast<char*>(out_msg));
THREAD_ENTER; THREAD_ENTER();
if (op == op_exec_immediate2) 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; FB_API_HANDLE handle = (transaction) ? transaction->rtr_handle : 0;
THREAD_EXIT; THREAD_EXIT();
GDS_DSQL_EXECUTE(status_vector, GDS_DSQL_EXECUTE(status_vector,
&handle, &handle,
&statement->rsr_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_type,
out_msg_length, out_msg_length,
reinterpret_cast<char*>(out_msg)); reinterpret_cast<char*>(out_msg));
THREAD_ENTER; THREAD_ENTER();
if (op == op_execute2) if (op == op_execute2)
{ {
@ -1992,7 +1992,7 @@ ISC_STATUS rem_port::fetch(P_SQLDATA * sqldata, PACKET* sendL)
if (!message->msg_address) { if (!message->msg_address) {
fb_assert(statement->rsr_msgs_waiting == 0); fb_assert(statement->rsr_msgs_waiting == 0);
THREAD_EXIT; THREAD_EXIT();
s = GDS_DSQL_FETCH(status_vector, s = GDS_DSQL_FETCH(status_vector,
&statement->rsr_handle, &statement->rsr_handle,
sqldata->p_sqldata_blr.cstr_length, sqldata->p_sqldata_blr.cstr_length,
@ -2001,7 +2001,7 @@ ISC_STATUS rem_port::fetch(P_SQLDATA * sqldata, PACKET* sendL)
msg_length, msg_length,
reinterpret_cast<char*>(message->msg_buffer)); reinterpret_cast<char*>(message->msg_buffer));
THREAD_ENTER; THREAD_ENTER();
statement->rsr_flags |= RSR_fetched; statement->rsr_flags |= RSR_fetched;
if (s) { if (s) {
if (s == 100 || s == 101) { if (s == 100 || s == 101) {
@ -2069,7 +2069,7 @@ ISC_STATUS rem_port::fetch(P_SQLDATA * sqldata, PACKET* sendL)
next->msg_next = message; next->msg_next = message;
next = message; next = message;
} }
THREAD_EXIT; THREAD_EXIT();
s = GDS_DSQL_FETCH(status_vector, s = GDS_DSQL_FETCH(status_vector,
&statement->rsr_handle, &statement->rsr_handle,
sqldata->p_sqldata_blr.cstr_length, 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, sqldata->p_sqldata_message_number,
msg_length, msg_length,
reinterpret_cast<char*>(message->msg_buffer)); reinterpret_cast<char*>(message->msg_buffer));
THREAD_ENTER; THREAD_ENTER();
if (s) { if (s) {
if (status_vector[1]) { if (status_vector[1]) {
/* If already have an error queued, don't overwrite it */ /* 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; ISC_STATUS s = 0;
message = statement->rsr_buffer; message = statement->rsr_buffer;
THREAD_EXIT; THREAD_EXIT();
s = GDS_DSQL_FETCH(status_vector, s = GDS_DSQL_FETCH(status_vector,
&statement->rsr_handle, &statement->rsr_handle,
sqldata->p_sqldata_blr.cstr_length, 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, sqldata->p_sqldata_message_number,
msg_length, msg_length,
reinterpret_cast<char*>(message->msg_buffer)); reinterpret_cast<char*>(message->msg_buffer));
THREAD_ENTER; THREAD_ENTER();
if (!status_vector[1] || if (!status_vector[1] ||
status_vector[1] != isc_segment || status_vector[1] != isc_segstr_eof) 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; ISC_STATUS_ARRAY status_vector;
UCHAR info_buffer[128]; UCHAR info_buffer[128];
THREAD_EXIT; THREAD_EXIT();
isc_request_info(status_vector, &request->rrq_handle, incarnation, isc_request_info(status_vector, &request->rrq_handle, incarnation,
sizeof(request_info), reinterpret_cast<const SCHAR*>(request_info), sizeof(request_info), reinterpret_cast<const SCHAR*>(request_info),
sizeof(info_buffer), reinterpret_cast<char*>(info_buffer)); sizeof(info_buffer), reinterpret_cast<char*>(info_buffer));
THREAD_ENTER; THREAD_ENTER();
if (status_vector[1]) if (status_vector[1])
return false; return false;
@ -2314,11 +2314,11 @@ ISC_STATUS rem_port::get_segment(P_SGMT* segment, PACKET* sendL)
if (this->port_flags & PORT_rpc) if (this->port_flags & PORT_rpc)
{ {
length = 0; length = 0;
THREAD_EXIT; THREAD_EXIT();
isc_get_segment(status_vector, &blob->rbl_handle, &length, isc_get_segment(status_vector, &blob->rbl_handle, &length,
segment->p_sgmt_length, segment->p_sgmt_length,
reinterpret_cast<char*>(buffer)); reinterpret_cast<char*>(buffer));
THREAD_ENTER; THREAD_ENTER();
const ISC_STATUS status = const ISC_STATUS status =
this->send_response(sendL, blob->rbl_id, length, status_vector); this->send_response(sendL, blob->rbl_id, length, status_vector);
#ifdef DEBUG_REMOTE_MEMORY #ifdef DEBUG_REMOTE_MEMORY
@ -2342,10 +2342,10 @@ ISC_STATUS rem_port::get_segment(P_SGMT* segment, PACKET* sendL)
while (buffer_length > 2) { while (buffer_length > 2) {
buffer_length -= 2; buffer_length -= 2;
p += 2; p += 2;
THREAD_EXIT; THREAD_EXIT();
isc_get_segment(status_vector, &blob->rbl_handle, &length, isc_get_segment(status_vector, &blob->rbl_handle, &length,
buffer_length, reinterpret_cast<char*>(p)); buffer_length, reinterpret_cast<char*>(p));
THREAD_ENTER; THREAD_ENTER();
if (status_vector[1] == isc_segstr_eof) if (status_vector[1] == isc_segstr_eof)
{ {
state = 2; state = 2;
@ -2430,7 +2430,7 @@ ISC_STATUS rem_port::get_slice(P_SLC * stuff, PACKET* sendL)
} }
P_SLR* response = &sendL->p_slr; P_SLR* response = &sendL->p_slr;
THREAD_EXIT; THREAD_EXIT();
isc_get_slice(status_vector, &rdb->rdb_handle, &transaction->rtr_handle, isc_get_slice(status_vector, &rdb->rdb_handle, &transaction->rtr_handle,
(ISC_QUAD*) &stuff->p_slc_id, stuff->p_slc_sdl.cstr_length, (ISC_QUAD*) &stuff->p_slc_id, stuff->p_slc_sdl.cstr_length,
reinterpret_cast<const char*>(stuff->p_slc_sdl.cstr_address), reinterpret_cast<const char*>(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, (const ISC_LONG*) stuff->p_slc_parameters.cstr_address,
stuff->p_slc_length, slice, stuff->p_slc_length, slice,
reinterpret_cast<SLONG*>(&response->p_slr_length)); reinterpret_cast<SLONG*>(&response->p_slr_length));
THREAD_ENTER; THREAD_ENTER();
ISC_STATUS status; ISC_STATUS status;
if (status_vector[1]) if (status_vector[1])
@ -2512,17 +2512,17 @@ ISC_STATUS rem_port::info(P_OP op, P_INFO * stuff, PACKET* sendL)
type_rbl, type_rbl,
stuff->p_info_object, stuff->p_info_object,
isc_bad_segstr_handle); isc_bad_segstr_handle);
THREAD_EXIT; THREAD_EXIT();
isc_blob_info(status_vector, &blob->rbl_handle, isc_blob_info(status_vector, &blob->rbl_handle,
stuff->p_info_items.cstr_length, stuff->p_info_items.cstr_length,
reinterpret_cast<char*>(stuff->p_info_items.cstr_address), reinterpret_cast<char*>(stuff->p_info_items.cstr_address),
stuff->p_info_buffer_length, stuff->p_info_buffer_length,
reinterpret_cast<char*>(buffer)); reinterpret_cast<char*>(buffer));
THREAD_ENTER; THREAD_ENTER();
break; break;
case op_info_database: case op_info_database:
THREAD_EXIT; THREAD_EXIT();
isc_database_info(status_vector, &rdb->rdb_handle, isc_database_info(status_vector, &rdb->rdb_handle,
stuff->p_info_items.cstr_length, stuff->p_info_items.cstr_length,
reinterpret_cast<const char*>(stuff->p_info_items.cstr_address), reinterpret_cast<const char*>(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<UCHAR*>(this->port_host->str_data), reinterpret_cast<UCHAR*>(this->port_host->str_data),
0); 0);
} }
THREAD_ENTER; THREAD_ENTER();
break; break;
case op_info_request: case op_info_request:
@ -2548,14 +2548,14 @@ ISC_STATUS rem_port::info(P_OP op, P_INFO * stuff, PACKET* sendL)
type_rrq, type_rrq,
stuff->p_info_object, stuff->p_info_object,
isc_bad_req_handle); isc_bad_req_handle);
THREAD_EXIT; THREAD_EXIT();
isc_request_info(status_vector, &requestL->rrq_handle, isc_request_info(status_vector, &requestL->rrq_handle,
stuff->p_info_incarnation, stuff->p_info_incarnation,
stuff->p_info_items.cstr_length, stuff->p_info_items.cstr_length,
reinterpret_cast<const char*>(stuff->p_info_items.cstr_address), reinterpret_cast<const char*>(stuff->p_info_items.cstr_address),
stuff->p_info_buffer_length, stuff->p_info_buffer_length,
reinterpret_cast<char*>(buffer)); reinterpret_cast<char*>(buffer));
THREAD_ENTER; THREAD_ENTER();
break; break;
case op_info_transaction: case op_info_transaction:
@ -2564,17 +2564,17 @@ ISC_STATUS rem_port::info(P_OP op, P_INFO * stuff, PACKET* sendL)
type_rtr, type_rtr,
stuff->p_info_object, stuff->p_info_object,
isc_bad_trans_handle); isc_bad_trans_handle);
THREAD_EXIT; THREAD_EXIT();
isc_transaction_info(status_vector, &transaction->rtr_handle, isc_transaction_info(status_vector, &transaction->rtr_handle,
stuff->p_info_items.cstr_length, stuff->p_info_items.cstr_length,
reinterpret_cast<const char*>(stuff->p_info_items.cstr_address), reinterpret_cast<const char*>(stuff->p_info_items.cstr_address),
stuff->p_info_buffer_length, stuff->p_info_buffer_length,
reinterpret_cast < char *>(buffer)); reinterpret_cast < char *>(buffer));
THREAD_ENTER; THREAD_ENTER();
break; break;
case op_service_info: case op_service_info:
THREAD_EXIT; THREAD_EXIT();
isc_service_query(status_vector, isc_service_query(status_vector,
&rdb->rdb_handle, &rdb->rdb_handle,
NULL, 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), const char*>(stuff->p_info_recv_items.cstr_address),
stuff->p_info_buffer_length, stuff->p_info_buffer_length,
reinterpret_cast<char*>(buffer)); reinterpret_cast<char*>(buffer));
THREAD_ENTER; THREAD_ENTER();
break; break;
case op_info_sql: case op_info_sql:
@ -2595,7 +2595,7 @@ ISC_STATUS rem_port::info(P_OP op, P_INFO * stuff, PACKET* sendL)
type_rsr, type_rsr,
stuff->p_info_object, stuff->p_info_object,
isc_bad_req_handle); isc_bad_req_handle);
THREAD_EXIT; THREAD_EXIT();
GDS_DSQL_SQL_INFO(status_vector, GDS_DSQL_SQL_INFO(status_vector,
&statement->rsr_handle, &statement->rsr_handle,
stuff->p_info_items.cstr_length, 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), const char*>(stuff->p_info_items.cstr_address),
stuff->p_info_buffer_length, stuff->p_info_buffer_length,
reinterpret_cast < char *>(buffer)); reinterpret_cast < char *>(buffer));
THREAD_ENTER; THREAD_ENTER();
break; break;
} }
@ -2663,14 +2663,14 @@ ISC_STATUS rem_port::insert(P_SQLDATA * sqldata, PACKET* sendL)
msg = NULL; msg = NULL;
} }
THREAD_EXIT; THREAD_EXIT();
GDS_DSQL_INSERT(status_vector, GDS_DSQL_INSERT(status_vector,
&statement->rsr_handle, &statement->rsr_handle,
sqldata->p_sqldata_blr.cstr_length, sqldata->p_sqldata_blr.cstr_length,
reinterpret_cast<const char*>(sqldata->p_sqldata_blr.cstr_address), reinterpret_cast<const char*>(sqldata->p_sqldata_blr.cstr_address),
sqldata->p_sqldata_message_number, msg_length, sqldata->p_sqldata_message_number, msg_length,
reinterpret_cast<const char*>(msg)); reinterpret_cast<const char*>(msg));
THREAD_ENTER; THREAD_ENTER();
return this->send_response(sendL, 0, 0, status_vector); 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; bpb = stuff->p_blob_bpb.cstr_address;
} }
THREAD_EXIT; THREAD_EXIT();
if (op == op_open_blob || op == op_open_blob2) if (op == op_open_blob || op == op_open_blob2)
isc_open_blob2(status_vector, &rdb->rdb_handle, isc_open_blob2(status_vector, &rdb->rdb_handle,
&transaction->rtr_handle, &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, isc_create_blob2(status_vector, &rdb->rdb_handle, &transaction->rtr_handle,
&handle, (ISC_QUAD*) &sendL->p_resp.p_resp_blob_id, &handle, (ISC_QUAD*) &sendL->p_resp.p_resp_blob_id,
bpb_length, reinterpret_cast<const char*>(bpb)); bpb_length, reinterpret_cast<const char*>(bpb));
THREAD_ENTER; THREAD_ENTER();
USHORT object; USHORT object;
if (status_vector[1]) if (status_vector[1])
@ -2769,9 +2769,9 @@ ISC_STATUS rem_port::open_blob(P_OP op, P_BLOB* stuff, PACKET* sendL)
else else
{ {
object = 0; object = 0;
THREAD_EXIT; THREAD_EXIT();
isc_cancel_blob(status_vector, &blob->rbl_handle); isc_cancel_blob(status_vector, &blob->rbl_handle);
THREAD_ENTER; THREAD_ENTER();
ALLR_release(blob); ALLR_release(blob);
status_vector[0] = isc_arg_gds; status_vector[0] = isc_arg_gds;
status_vector[1] = isc_too_many_handles; 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, stuff->p_prep_transaction,
isc_bad_trans_handle); isc_bad_trans_handle);
THREAD_EXIT; THREAD_EXIT();
if (!isc_prepare_transaction2(status_vector, &transaction->rtr_handle, if (!isc_prepare_transaction2(status_vector, &transaction->rtr_handle,
stuff->p_prep_data.cstr_length, stuff->p_prep_data.cstr_length,
stuff->p_prep_data.cstr_address)) stuff->p_prep_data.cstr_address))
{ {
transaction->rtr_flags |= RTR_limbo; transaction->rtr_flags |= RTR_limbo;
} }
THREAD_ENTER; THREAD_ENTER();
return this->send_response(sendL, 0, 0, status_vector); 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; const USHORT parser_version = (this->port_protocol < PROTOCOL_VERSION10) ? 1 : 2;
THREAD_EXIT; THREAD_EXIT();
GDS_DSQL_PREPARE(status_vector, GDS_DSQL_PREPARE(status_vector,
&handle, &handle,
&statement->rsr_handle, &statement->rsr_handle,
@ -2891,7 +2891,7 @@ ISC_STATUS rem_port::prepare_statement(P_SQLST * prepareL, PACKET* sendL)
reinterpret_cast<const char*>(prepareL->p_sqlst_items.cstr_address), reinterpret_cast<const char*>(prepareL->p_sqlst_items.cstr_address),
prepareL->p_sqlst_buffer_length, prepareL->p_sqlst_buffer_length,
reinterpret_cast<char*>(buffer)); reinterpret_cast<char*>(buffer));
THREAD_ENTER; THREAD_ENTER();
if (status_vector[1]) { if (status_vector[1]) {
if (buffer != local_buffer) if (buffer != local_buffer)
@ -3251,10 +3251,10 @@ ISC_STATUS rem_port::put_segment(P_OP op, P_SGMT * segment, PACKET* sendL)
bad news. */ bad news. */
if (op == op_put_segment) { if (op == op_put_segment) {
THREAD_EXIT; THREAD_EXIT();
isc_put_segment(status_vector, &blob->rbl_handle, length, isc_put_segment(status_vector, &blob->rbl_handle, length,
reinterpret_cast<const char*>(p)); reinterpret_cast<const char*>(p));
THREAD_ENTER; THREAD_ENTER();
return this->send_response(sendL, 0, 0, status_vector); 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) { while (p < end) {
length = *p++; length = *p++;
length += *p++ << 8; length += *p++ << 8;
THREAD_EXIT; THREAD_EXIT();
isc_put_segment(status_vector, &blob->rbl_handle, length, isc_put_segment(status_vector, &blob->rbl_handle, length,
reinterpret_cast<const char*>(p)); reinterpret_cast<const char*>(p));
THREAD_ENTER; THREAD_ENTER();
if (status_vector[1]) if (status_vector[1])
return this->send_response(sendL, 0, 0, status_vector); return this->send_response(sendL, 0, 0, status_vector);
p += length; p += length;
@ -3301,7 +3301,7 @@ ISC_STATUS rem_port::put_slice(P_SLC * stuff, PACKET* sendL)
RDB rdb = this->port_context; RDB rdb = this->port_context;
THREAD_EXIT; THREAD_EXIT();
sendL->p_resp.p_resp_blob_id = stuff->p_slc_id; sendL->p_resp.p_resp_blob_id = stuff->p_slc_id;
isc_put_slice(status_vector, &rdb->rdb_handle, &transaction->rtr_handle, isc_put_slice(status_vector, &rdb->rdb_handle, &transaction->rtr_handle,
(ISC_QUAD*) &sendL->p_resp.p_resp_blob_id, (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, (ISC_LONG *) stuff->p_slc_parameters.cstr_address,
stuff->p_slc_slice.lstr_length, stuff->p_slc_slice.lstr_length,
stuff->p_slc_slice.lstr_address); stuff->p_slc_slice.lstr_address);
THREAD_ENTER; THREAD_ENTER();
return this->send_response(sendL, 0, 0, status_vector); 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_rid = stuff->p_event_rid;
event->rvnt_rdb = rdb; event->rvnt_rdb = rdb;
THREAD_EXIT; THREAD_EXIT();
ISC_STATUS_ARRAY status_vector; ISC_STATUS_ARRAY status_vector;
isc_que_events(status_vector, &rdb->rdb_handle, &event->rvnt_id, isc_que_events(status_vector, &rdb->rdb_handle, &event->rvnt_id,
stuff->p_event_items.cstr_length, stuff->p_event_items.cstr_length,
reinterpret_cast<const char*>(stuff->p_event_items.cstr_address), reinterpret_cast<const char*>(stuff->p_event_items.cstr_address),
server_ast, server_ast,
event); event);
THREAD_ENTER; THREAD_ENTER();
const SLONG id = event->rvnt_id; const SLONG id = event->rvnt_id;
if (status_vector[1]) { if (status_vector[1]) {
@ -3533,7 +3533,7 @@ ISC_STATUS rem_port::receive_msg(P_DATA * data, PACKET* sendL)
return res; return res;
} }
THREAD_EXIT; THREAD_EXIT();
#ifdef SCROLLABLE_CURSORS #ifdef SCROLLABLE_CURSORS
isc_receive2(status_vector, &requestL->rrq_handle, msg_number, isc_receive2(status_vector, &requestL->rrq_handle, msg_number,
format->fmt_length, message->msg_buffer, level, 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, isc_receive(status_vector, &requestL->rrq_handle, msg_number,
format->fmt_length, message->msg_buffer, level); format->fmt_length, message->msg_buffer, level);
#endif #endif
THREAD_ENTER; THREAD_ENTER();
if (status_vector[1]) if (status_vector[1])
return this->send_response(sendL, 0, 0, status_vector); 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, just doing a simple lookahead continuing on in the last direction specified,
so there is no reason to do an isc_receive2() */ so there is no reason to do an isc_receive2() */
THREAD_EXIT; THREAD_EXIT();
isc_receive(status_vector, &requestL->rrq_handle, msg_number, isc_receive(status_vector, &requestL->rrq_handle, msg_number,
format->fmt_length, format->fmt_length,
message->msg_buffer, data->p_data_incarnation); message->msg_buffer, data->p_data_incarnation);
THREAD_ENTER; THREAD_ENTER();
/* Did we have an error? If so, save it for later delivery */ /* 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 SSHORT mode = seek->p_seek_mode;
const SLONG offset = seek->p_seek_offset; const SLONG offset = seek->p_seek_offset;
THREAD_EXIT; THREAD_EXIT();
SLONG result; SLONG result;
isc_seek_blob(status_vector, &blob->rbl_handle, mode, offset, &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; 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; REM_MSG message = requestL->rrq_rpt[number].rrq_message;
const rem_fmt* format = requestL->rrq_rpt[number].rrq_format; 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, isc_send(status_vector, &requestL->rrq_handle, number, format->fmt_length,
message->msg_address, data->p_data_incarnation); message->msg_address, data->p_data_incarnation);
THREAD_ENTER; THREAD_ENTER();
message->msg_address = NULL; message->msg_address = NULL;
@ -4204,13 +4204,13 @@ static void server_ast(void* event_void, USHORT length, const UCHAR* items)
**************************************/ **************************************/
RVNT event = static_cast<rvnt*>(event_void); RVNT event = static_cast<rvnt*>(event_void);
THREAD_ENTER; THREAD_ENTER();
event->rvnt_id = 0; event->rvnt_id = 0;
RDB rdb = event->rvnt_rdb; RDB rdb = event->rvnt_rdb;
rem_port* port = rdb->rdb_port->port_async; rem_port* port = rdb->rdb_port->port_async;
if (!port) { if (!port) {
THREAD_EXIT; THREAD_EXIT();
return; 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; p_event->p_event_rid = event->rvnt_rid;
port->send(&packet); 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. */ they will be stuffed in the SPB if so. */
REMOTE_get_timeout_params(this, spb, spb_length); REMOTE_get_timeout_params(this, spb, spb_length);
THREAD_EXIT; THREAD_EXIT();
ISC_STATUS_ARRAY status_vector; ISC_STATUS_ARRAY status_vector;
isc_service_attach(status_vector, isc_service_attach(status_vector,
service_length, service_length,
@ -4298,7 +4298,7 @@ ISC_STATUS rem_port::service_attach(P_ATCH* attach, PACKET* sendL)
&handle, &handle,
spb_length, spb_length,
reinterpret_cast<const char*>(spb)); reinterpret_cast<const char*>(spb));
THREAD_ENTER; THREAD_ENTER();
if (new_spb != new_spb_buffer) if (new_spb != new_spb_buffer)
ALLR_free(new_spb); ALLR_free(new_spb);
@ -4334,9 +4334,9 @@ ISC_STATUS rem_port::service_end(P_RLSE * release, PACKET* sendL)
ISC_STATUS_ARRAY status_vector; ISC_STATUS_ARRAY status_vector;
THREAD_EXIT; THREAD_EXIT();
isc_service_detach(status_vector, &rdb->rdb_handle); isc_service_detach(status_vector, &rdb->rdb_handle);
THREAD_ENTER; THREAD_ENTER();
return this->send_response(sendL, 0, 0, status_vector); 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; ISC_STATUS_ARRAY status_vector;
THREAD_EXIT; THREAD_EXIT();
SLONG* reserved = 0; // reserved for future use SLONG* reserved = 0; // reserved for future use
isc_service_start(status_vector, isc_service_start(status_vector,
&rdb->rdb_handle, &rdb->rdb_handle,
reserved, reserved,
stuff->p_info_items.cstr_length, stuff->p_info_items.cstr_length,
reinterpret_cast<char*>(stuff->p_info_items.cstr_address)); reinterpret_cast<char*>(stuff->p_info_items.cstr_address));
THREAD_ENTER; THREAD_ENTER();
return this->send_response(sendL, 0, 0, status_vector); 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, sqlcur->p_sqlcur_statement,
isc_bad_req_handle); isc_bad_req_handle);
THREAD_EXIT; THREAD_EXIT();
GDS_DSQL_SET_CURSOR(status_vector, GDS_DSQL_SET_CURSOR(status_vector,
&statement->rsr_handle, &statement->rsr_handle,
reinterpret_cast<const char*>(sqlcur->p_sqlcur_cursor_name.cstr_address), reinterpret_cast<const char*>(sqlcur->p_sqlcur_cursor_name.cstr_address),
sqlcur->p_sqlcur_type); sqlcur->p_sqlcur_type);
THREAD_ENTER; THREAD_ENTER();
return this->send_response(sendL, 0, 0, status_vector); 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); requestL = REMOTE_find_request(requestL, data->p_data_incarnation);
REMOTE_reset_request(requestL, 0); REMOTE_reset_request(requestL, 0);
THREAD_EXIT; THREAD_EXIT();
isc_start_request(status_vector, &requestL->rrq_handle, isc_start_request(status_vector, &requestL->rrq_handle,
&transaction->rtr_handle, data->p_data_incarnation); &transaction->rtr_handle, data->p_data_incarnation);
THREAD_ENTER; THREAD_ENTER();
if (!status_vector[1]) { if (!status_vector[1]) {
requestL->rrq_rtr = transaction; requestL->rrq_rtr = transaction;
@ -4518,12 +4518,12 @@ ISC_STATUS rem_port::start_and_send(P_OP operation,
REMOTE_reset_request(requestL, message); REMOTE_reset_request(requestL, message);
THREAD_EXIT; THREAD_EXIT();
isc_start_and_send(status_vector, &requestL->rrq_handle, isc_start_and_send(status_vector, &requestL->rrq_handle,
&transaction->rtr_handle, number, &transaction->rtr_handle, number,
format->fmt_length, message->msg_address, format->fmt_length, message->msg_address,
data->p_data_incarnation); data->p_data_incarnation);
THREAD_ENTER; THREAD_ENTER();
if (!status_vector[1]) { if (!status_vector[1]) {
requestL->rrq_rtr = transaction; 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; RDB rdb = this->port_context;
FB_API_HANDLE handle = 0; FB_API_HANDLE handle = 0;
THREAD_EXIT; THREAD_EXIT();
if (operation == op_reconnect) if (operation == op_reconnect)
isc_reconnect_transaction(status_vector, &rdb->rdb_handle, &handle, isc_reconnect_transaction(status_vector, &rdb->rdb_handle, &handle,
stuff->p_sttr_tpb.cstr_length, 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, isc_start_transaction(status_vector, &handle, (SSHORT) 1, &rdb->rdb_handle,
stuff->p_sttr_tpb.cstr_length, stuff->p_sttr_tpb.cstr_length,
stuff->p_sttr_tpb.cstr_address); stuff->p_sttr_tpb.cstr_address);
THREAD_ENTER; THREAD_ENTER();
OBJCT object; OBJCT object;
if (status_vector[1]) if (status_vector[1])
@ -4584,7 +4584,7 @@ ISC_STATUS rem_port::start_transaction(P_OP operation, P_STTR * stuff, PACKET* s
} }
else { else {
object = 0; object = 0;
THREAD_EXIT; THREAD_EXIT();
if (operation != op_reconnect) if (operation != op_reconnect)
isc_rollback_transaction(status_vector, &handle); isc_rollback_transaction(status_vector, &handle);
#ifdef SUPERSERVER #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); gds__handle_cleanup(status_vector, &handle);
} }
#endif #endif
THREAD_ENTER; THREAD_ENTER();
status_vector[0] = isc_arg_gds; status_vector[0] = isc_arg_gds;
status_vector[1] = isc_too_many_handles; status_vector[1] = isc_too_many_handles;
status_vector[2] = isc_arg_end; status_vector[2] = isc_arg_end;
@ -4653,7 +4653,7 @@ static int THREAD_ROUTINE loopThread(void* flags)
USHORT inactive_count = 0; USHORT inactive_count = 0;
USHORT timedout_count = 0; USHORT timedout_count = 0;
THREAD_ENTER; THREAD_ENTER();
rem_port* port; rem_port* port;
@ -4675,9 +4675,9 @@ static int THREAD_ROUTINE loopThread(void* flags)
port = request->req_port; port = request->req_port;
request->req_next = free_requests; request->req_next = free_requests;
free_requests = request; free_requests = request;
THREAD_EXIT; THREAD_EXIT();
SRVR_main(port, port->port_server_flags); SRVR_main(port, port->port_server_flags);
THREAD_ENTER; THREAD_ENTER();
request = 0; request = 0;
continue; continue;
} }
@ -4778,7 +4778,7 @@ static int THREAD_ROUTINE loopThread(void* flags)
} }
threads_waiting++; threads_waiting++;
THREAD_EXIT; THREAD_EXIT();
/* Wait for 1 minute (60 seconds) on a new request */ /* Wait for 1 minute (60 seconds) on a new request */
REMOTE_TRACE(("Wait for event")); REMOTE_TRACE(("Wait for event"));
if (!requests_semaphore.tryEnter(60)) { if (!requests_semaphore.tryEnter(60)) {
@ -4788,12 +4788,12 @@ static int THREAD_ROUTINE loopThread(void* flags)
else { else {
REMOTE_TRACE(("got it")); REMOTE_TRACE(("got it"));
} }
THREAD_ENTER; THREAD_ENTER();
--threads_waiting; --threads_waiting;
} }
} }
THREAD_EXIT; THREAD_EXIT();
#ifdef WIN_NT #ifdef WIN_NT
if (!((SLONG) flags & SRVR_non_service)) 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-> (procedure->rpr_out_format) ? procedure->rpr_out_format->
fmt_length : 0; fmt_length : 0;
THREAD_EXIT; THREAD_EXIT();
isc_transact_request(status_vector, isc_transact_request(status_vector,
&rdb->rdb_handle, &rdb->rdb_handle,
&transaction->rtr_handle, &transaction->rtr_handle,
@ -4849,7 +4849,7 @@ ISC_STATUS rem_port::transact_request(P_TRRQ* trrq, PACKET* sendL)
reinterpret_cast<char*>(in_msg), reinterpret_cast<char*>(in_msg),
out_msg_length, out_msg_length,
reinterpret_cast<char*>(out_msg)); reinterpret_cast<char*>(out_msg));
THREAD_ENTER; THREAD_ENTER();
if (status_vector[1]) if (status_vector[1])
return this->send_response(sendL, 0, 0, status_vector); return this->send_response(sendL, 0, 0, status_vector);

View File

@ -143,10 +143,10 @@ static MUTX_T xnet_mutex;
#elif defined(SUPERSERVER) #elif defined(SUPERSERVER)
#define XNET_LOCK if (!xnet_shutdown) \ #define XNET_LOCK if (!xnet_shutdown) \
THREAD_EXIT; \ THREAD_EXIT(); \
THD_mutex_lock(&xnet_mutex); \ THD_mutex_lock(&xnet_mutex); \
if (!xnet_shutdown) \ if (!xnet_shutdown) \
THREAD_ENTER; THREAD_ENTER();
#define XNET_UNLOCK THD_mutex_unlock(&xnet_mutex) #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; xdrs->x_private += to_copy;
} }
else { else {
THREAD_EXIT; THREAD_EXIT();
if (!xnet_read(xdrs)) { if (!xnet_read(xdrs)) {
THREAD_ENTER; THREAD_ENTER();
return FALSE; return FALSE;
}; };
THREAD_ENTER; THREAD_ENTER();
} }
if (to_copy) { 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) { if ((ULONG) xdrs->x_handy == xch->xch_size) {
THREAD_EXIT; THREAD_EXIT();
while (!xnet_shutdown) { while (!xnet_shutdown) {
const DWORD wait_result = 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); isc_conn_lost, 0);
#endif #endif
THREAD_ENTER; THREAD_ENTER();
return FALSE; return FALSE;
} }
} }
else { else {
XNET_ERROR(port, "WaitForSingleObject()", isc_net_write_err, ERRNO); XNET_ERROR(port, "WaitForSingleObject()", isc_net_write_err, ERRNO);
THREAD_ENTER; THREAD_ENTER();
return FALSE; /* a non-timeout result is an error */ return FALSE; /* a non-timeout result is an error */
} }
} }
THREAD_ENTER; THREAD_ENTER();
} }
if (to_copy == sizeof(SLONG)) 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; DWORD config_len;
config = (LPQUERY_SERVICE_CONFIG) buffer; config = (LPQUERY_SERVICE_CONFIG) buffer;
THREAD_EXIT; THREAD_EXIT();
if (!QueryServiceConfig(service, config, sizeof(buffer), &config_len)) if (!QueryServiceConfig(service, config, sizeof(buffer), &config_len))
{ {
config = (LPQUERY_SERVICE_CONFIG) ALLR_alloc(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); ALLR_free(config);
} }
CloseServiceHandle(service); CloseServiceHandle(service);
THREAD_ENTER; THREAD_ENTER();
} }
else { else {
strcpy(XNET_command_line, GetCommandLine()); strcpy(XNET_command_line, GetCommandLine());
@ -2546,9 +2546,9 @@ void XNET_srv(USHORT flag)
// mark connect area as untouched // mark connect area as untouched
// presponse->proc_id = CurrentProcessId; // presponse->proc_id = CurrentProcessId;
THREAD_EXIT; THREAD_EXIT();
const DWORD wait_res = WaitForSingleObject(xnet_connect_event, INFINITE); const DWORD wait_res = WaitForSingleObject(xnet_connect_event, INFINITE);
THREAD_ENTER; THREAD_ENTER();
if (wait_res != WAIT_OBJECT_0) { if (wait_res != WAIT_OBJECT_0) {
XNET_LOG_ERRORC("WaitForSingleObject() failed"); XNET_LOG_ERRORC("WaitForSingleObject() failed");