[omniORB] Win32 Question

Steven W. Brenneis brennes1@rjrt.com
Fri, 04 Jun 1999 15:47:00 -0400


ryan.tecco wrote:
> 
> Steve,
>   I placed the impl_is_ready(0,1) call in the OnIdle function, but it
> doesn't appear to get run. I am running a computationally expensive
> ActiveX control in my application. Do you think this is preventing OnIdle
> from being run?
> 
> This definitely the solution to the problem. Moving that one line from
> place to place will either make the app work or crash it.
> 
> Suggestions would be helpful.
> 
> rt
> 
> --------------
> ryan.tecco
> 734.647.8057
> microcosm/CAVE programmer
> the university of michigan
> "when all the pettiness is gone,
> what do we really have?"
> 

Ryan,

We have created a global function:

void* run_orb(void* p) {
  try {
    static_cast<CORBA::BOA*>(p)->impl_is_ready();
  }
  catch (omni_thread_fatal& e) {
    std::cerr << "Fatal omnithread exception.  Error code = " <<
e.error;
    std::cerr << ".  BOA thread terminated." << std::endl;
  }
  catch(...) {
    std::cerr << "Unknown BOA exception. BOA thread terminated." <<
std::endl;
  }
  return 0;
}

The output to std::cerr is used when this code resides on command-line
platforms, you can send them to AfxTrace's or to log files or ditch them
completely on Windows platforms.

Then from WinMain or CWinApp::OnInitInstance we do this:

CORBA::ORB_ptr my_orb = CORBA::ORB_init(argc,argv,"omniORB2");
CORBA::BOA_ptr my_boa = my_orb->BOA_init(argc,argv,"omniORB2_BOA");

boa_thread = new omni_thread(run_orb,my_boa);
boa_thread->start();

Actually we have encapsulated all this in a class so what I have above
is a paraphrase, but you get the idea.

At the end of WinMain or in the CWinApp::OnExitInstance member you will
need to do something like:

CORBA::BOA::getBOA()->impl_shutdown();
void* result;
boa_thread->join(&result);

Good Luck.