[omniORB] Is CORBA::BOA::impl_is_ready(0,0) really blocking?

Visscher, Bruce VISSCHB at RJRT.com
Tue Aug 10 19:29:23 BST 2004


The following code is compiled against a recent (just prior to 4.0.4)
CVS snapshot on OpenVMS 7.3.  [The file names and locations have been
changed to protect the guilty]:

---------------------------- boaquitter.cxx ----------------------------
#include <omniORB4/CORBA.h>
#include <stdlib.h>
#include <stdio.h>

void f(void*) {
    omni_thread::sleep(5);
    ::system(
    "copy/log anode::adevice:[dir.subdir]afile.dat []afile.new");
}

int main(int argc, char* argv[]) {
    CORBA::ORB* orb=CORBA::ORB_init(argc, argv);
    CORBA::BOA* boa=orb->BOA_init(argc, argv, "omniORB4_BOA");
    omni_thread* child=omni_thread::create(&f);
    boa->impl_is_ready();
    ::printf("should never reach here!\n");
}
---------------------------- boaquitter.cxx ----------------------------

This results in "should never reach here!" appearing on the screen.

I think the reason is that there isn't a predicate associated with the
omni_condition so the ::system call causes a spurious interrupt to
unblock the pthread_cond_wait call that is used in the implementation of
impl_is_ready.

It is my understanding that POSIX threads implementations are allowed to
let this happen (which is why pthread condition users are supposed to
have a predicate that they can check to see if the condition was really
signaled).

Is my understanding correct?

The good news is that CORBA::ORB::run() does seem to have an obvious
predicate so if I change the above to use orb->run() instead of
boa->impl_is_ready() the program doesn't exit.

Since the BOA is passe` then maybe this wouldn't be worth fixing. I'm
just really surprised I never discovered this before.  OTOH, it is
pretty surprising behavior and there might be a lot of existing code
out there that is relying on CORBA::BOA::impl_is_ready to keep a server
process running.

Bruce

-----------------------------------------
CONFIDENTIALITY NOTE:  This e-mail message, including any
attachment(s), contains information that may be confidential,
protected by the attorney-client or other legal privileges, and/or
proprietary non-public information.  If you are not an intended
recipient of this message or an authorized assistant to an intended
recipient, please notify the sender by replying to this message and
then delete it from your system.  Use, dissemination, distribution,
or reproduction of this message and/or any of its attachments (if
any) by unintended recipients is not authorized and may be unlawful.




More information about the omniORB-list mailing list