[omniORB] Problem using omni_condition::broadcast in an omniORB thread

Philippe Combes Philippe.Combes at ens-lyon.fr
Wed Jul 2 15:37:33 BST 2003


Hi all,

I use omniORB 4.0.1 on a Debian Linux (2.4.20) - which means Posix 
threads, doesn't it ?

I try to program a server that processes requests (submitted through the 
method "submit" of the server) only once a given amount 
(maxNbOfClientsConnected) of such requests have arrived.
I thought that each of these "submit" invokations was processed in an 
omniORB thread. So using an omni_condition (bufferOfRequests) would have 
been very useful :


CORBA::Long
ServerImpl::submit(...)
{
   // As the requests arrive sequentially, there is no need to
   // lock/unlock a mutex for this->nbOfClientsConnected

   if (this->nbOfClientsConnected < this->maxNbOfClientsConnected) {
     this->nbOfClientsConnected++;
     if (this->nbOfClientsConnected == this->maxNbOfClientsConnected) {
       this->bufferOfRequests->broadcast();
     } else {
       cout << "Waiting for buffer filled.\n";
       this->bufferOfRequests->wait();
     }
   }

   // Processing a request ...
}


Actually, when the maxNbOfClientsConnected-th request arrives, the 
broadcast awakens only the first request, and lets the last one 
continue, of course. It is exactly the same behaviour as if I used 
omni_condition::signal !!!

In another part of my application, I successfully use 
omni_condition::broadcast on omni_threads that I created and manage 
myself. Is the problem related to the fact that the "submit" invokations 
are managed by the omniORB pool of threads ?

If anyone can give me a hand ...

Thanks in advance.

Philippe Combes
-------------------------------------------------
Philippe Combes. IE INRIA, LIP - ENS Lyon
46, allée d'Italie
69364 Lyon Cedex 07, France
Tel: (+33)4 72 72 84 70, Fax: (+33)4 72 72 80 80
Web Page: http://www.ens-lyon.fr/~pcombes/
-------------------------------------------------




More information about the omniORB-list mailing list