int JAWS_TPOOL_Concurrency::getq (JAWS_Protocol_Handler *&ph) { ph = 0; JAWS_CONCURRENCY_TASK *task = this; if (this->shutdown_task_ && task->msg_queue ()->message_count () == 0) return -1; ACE_Message_Block *mb = 0; int result = task->getq (mb); if (result != -1) { ph = (JAWS_Protocol_Handler *) mb->base (); if (ph == 0) { // Shutdown this task; this->shutdown_task_ = 1; if (this->number_of_threads_ && this->number_of_threads_-- > 1) { task->putq (mb); result = -1; } } } return result; }
int JAWS_THYBRID_Concurrency::getq (JAWS_Protocol_Handler *&ph) { ph = 0; JAWS_CONCURRENCY_TASK *task = this; if (this->shutdown_task_ && task->msg_queue ()->message_count () == 0) return -1; int getting = ++(this->getting_); if (getting > this->min_number_of_threads_) { if (task->msg_queue ()->message_count () == 0) { --(this->getting_); return -1; } } ACE_Message_Block *mb = 0; int result = task->getq (mb); if (result != -1) { ph = (JAWS_Protocol_Handler *) mb->base (); if (ph == 0) { // Shutdown this task; this->shutdown_task_ = 1; if (this->getting_ > 1) { task->putq (mb); result = -1; } } } --(this->getting_); return result; }