mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 20:43:02 +01:00
Misc
This commit is contained in:
parent
5e9656b7c4
commit
4762e049ee
@ -5391,7 +5391,7 @@ static THREAD_ENTRY_DECLARE event_thread(THREAD_ENTRY_PARAM arg)
|
||||
/* read what should be an event message */
|
||||
|
||||
rem_port* stuff = NULL;
|
||||
{
|
||||
{ // scope
|
||||
Firebird::RefMutexGuard portGuard(*port->port_sync);
|
||||
stuff = port->receive(&packet);
|
||||
}
|
||||
@ -5413,7 +5413,7 @@ static THREAD_ENTRY_DECLARE event_thread(THREAD_ENTRY_PARAM arg)
|
||||
P_EVENT* pevent = &packet.p_event;
|
||||
|
||||
RVNT event = NULL;
|
||||
{
|
||||
{ // scope
|
||||
Firebird::RefMutexGuard portGuard(*port->port_sync);
|
||||
event = find_event(port, pevent->p_event_rid);
|
||||
}
|
||||
|
@ -486,14 +486,14 @@ struct rem_port
|
||||
PacketQueue* port_deferred_packets; /* queue of deferred packets */
|
||||
OBJCT port_last_object_id; /* cached last id */
|
||||
#ifdef REM_SERVER
|
||||
Firebird::ObjectsArray< Firebird::Array< char > >* port_queue;
|
||||
Firebird::ObjectsArray< Firebird::Array<char> >* port_queue;
|
||||
size_t port_qoffset; // current packet in the queue
|
||||
Firebird::RefMutex *port_que_sync;
|
||||
Firebird::RefMutex* port_que_sync;
|
||||
#endif
|
||||
#ifdef TRUSTED_AUTH
|
||||
ServerAuth* port_trusted_auth;
|
||||
#endif
|
||||
Firebird::RefMutex *port_sync;
|
||||
Firebird::RefMutex* port_sync;
|
||||
UCHAR port_buffer[1];
|
||||
|
||||
/* TMN: Beginning of C++ port */
|
||||
@ -511,9 +511,8 @@ struct rem_port
|
||||
bool haveRecvData() const
|
||||
{
|
||||
Firebird::RefMutexGuard queGuard(*port_que_sync);
|
||||
return (port_receive.x_handy > 0
|
||||
|| port_queue && (port_qoffset < port_queue->getCount())
|
||||
);
|
||||
return (port_receive.x_handy > 0 ||
|
||||
port_queue && (port_qoffset < port_queue->getCount()));
|
||||
}
|
||||
|
||||
void clearRecvQue()
|
||||
|
@ -221,9 +221,9 @@ public:
|
||||
Worker();
|
||||
~Worker();
|
||||
|
||||
bool Wait(int timeout = IDLE_TIMEOUT); // true is success, false if timeout
|
||||
static bool WakeUp();
|
||||
static void WakeUpAll();
|
||||
bool wait(int timeout = IDLE_TIMEOUT); // true is success, false if timeout
|
||||
static bool wakeUp();
|
||||
static void wakeUpAll();
|
||||
|
||||
void setState(const bool active);
|
||||
|
||||
@ -423,11 +423,13 @@ static bool link_request(rem_port* port, SERVER_REQ request)
|
||||
**************************************/
|
||||
const P_OP operation = request->req_receive.p_operation;
|
||||
SERVER_REQ queue;;
|
||||
{// request_que_mutex scope
|
||||
|
||||
{ // request_que_mutex scope
|
||||
Firebird::MutexLockGuard queGuard(request_que_mutex);
|
||||
|
||||
bool active = true;
|
||||
queue = active_requests;
|
||||
|
||||
while (true)
|
||||
{
|
||||
for (; queue; queue = queue->req_next)
|
||||
@ -449,8 +451,10 @@ static bool link_request(rem_port* port, SERVER_REQ request)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (queue || !active)
|
||||
break;
|
||||
|
||||
queue = request_que;
|
||||
active = false;
|
||||
}
|
||||
@ -534,6 +538,7 @@ void SRVR_multi_thread( rem_port* main_port, USHORT flags)
|
||||
|
||||
Firebird::RefMutexEnsureUnlock portGuard(*port->port_sync);
|
||||
const bool portLocked = port->port_sync->tryEnter();
|
||||
|
||||
if (portLocked || !dataSize)
|
||||
{
|
||||
// Allocate a memory block to store the request in
|
||||
@ -588,7 +593,7 @@ void SRVR_multi_thread( rem_port* main_port, USHORT flags)
|
||||
port->port_requests_queued);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
if (!Worker::WakeUp()) {
|
||||
if (!Worker::wakeUp()) {
|
||||
gds__thread_start(loopThread, (void*)(IPTR) flags,
|
||||
THREAD_medium, THREAD_ast, 0);
|
||||
}
|
||||
@ -5293,8 +5298,8 @@ static THREAD_ENTRY_DECLARE loopThread(THREAD_ENTRY_PARAM)
|
||||
|
||||
if (request->req_port->port_state != state_disconnected)
|
||||
{
|
||||
rem_port* parent_port =
|
||||
request->req_port->port_server->srvr_parent_port;
|
||||
rem_port* parent_port = request->req_port->port_server->srvr_parent_port;
|
||||
|
||||
if (parent_port == request->req_port)
|
||||
{
|
||||
process_packet(parent_port, &request->req_send,
|
||||
@ -5435,7 +5440,7 @@ static THREAD_ENTRY_DECLARE loopThread(THREAD_ENTRY_PARAM)
|
||||
if (shutting_down)
|
||||
break;
|
||||
|
||||
if (!worker.Wait())
|
||||
if (!worker.wait())
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -5461,7 +5466,7 @@ int SRVR_shutdown()
|
||||
|
||||
while (Worker::getCount()/* || cntServers.value()*/)
|
||||
{
|
||||
Worker::WakeUpAll();
|
||||
Worker::wakeUpAll();
|
||||
THREAD_SLEEP(100);
|
||||
}
|
||||
|
||||
@ -5604,7 +5609,7 @@ Worker::~Worker()
|
||||
}
|
||||
|
||||
|
||||
bool Worker::Wait(int timeout)
|
||||
bool Worker::wait(int timeout)
|
||||
{
|
||||
return m_sem.tryEnter(timeout);
|
||||
}
|
||||
@ -5619,7 +5624,7 @@ void Worker::setState(const bool active)
|
||||
insert(active);
|
||||
}
|
||||
|
||||
bool Worker::WakeUp()
|
||||
bool Worker::wakeUp()
|
||||
{
|
||||
Firebird::MutexLockGuard guard(m_mutex);
|
||||
if (m_idleWorkers)
|
||||
@ -5630,7 +5635,7 @@ bool Worker::WakeUp()
|
||||
return (m_cntAll >= MAX_THREADS);
|
||||
}
|
||||
|
||||
void Worker::WakeUpAll()
|
||||
void Worker::wakeUpAll()
|
||||
{
|
||||
Firebird::MutexLockGuard guard(m_mutex);
|
||||
for (Worker* thd = m_idleWorkers; thd; thd = thd->m_next)
|
||||
@ -5665,7 +5670,7 @@ void Worker::insert(const bool active)
|
||||
fb_assert(m_idleWorkers != this);
|
||||
fb_assert(m_activeWorkers != this);
|
||||
|
||||
Worker **list = active ? &m_activeWorkers : &m_idleWorkers;
|
||||
Worker** list = active ? &m_activeWorkers : &m_idleWorkers;
|
||||
m_next = *list;
|
||||
if (*list) {
|
||||
(*list)->m_prev = this;
|
||||
|
Loading…
Reference in New Issue
Block a user