Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / Bug_3321_Regression / main.cpp
blob125ea3132265005ecc0d6de0a814308b2a544a74
1 #include "tao/ORB.h"
2 #include "ace/Log_Msg.h"
3 #include "ace/Thread.h"
4 #include "ace/os_include/os_pthread.h"
6 #include "tao/ORB.h"
7 #include "ace/Log_Msg.h"
8 #include "tao/AnyTypeCode/Any.h"
9 #include "tao/Policy_Manager.h"
10 #include "tao/TimeBaseC.h"
12 int result = 0;
14 #if defined (__SUNPRO_CC)
15 extern "C"
16 #endif /* __SUNPRO_CC */
17 ACE_THR_FUNC_RETURN main_orb(void*)
19 try
21 int argc = 0;
22 ACE_TCHAR **argv = 0;
23 CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
25 TimeBase::TimeT CONNECTION_TIMEOUT = 1000000;
26 TimeBase::TimeT ROUND_TRIP_TIMEOUT = 1000000;
28 if (!CORBA::is_nil(orb.in()))
30 ACE_DEBUG((LM_DEBUG, "ORB not nil\n"));
32 CORBA::Any connection_timeout_as_any;
33 connection_timeout_as_any <<= CONNECTION_TIMEOUT;
35 CORBA::Any rt_timeout_as_any;
36 rt_timeout_as_any <<= ROUND_TRIP_TIMEOUT;
38 orb->destroy ();
39 ACE_DEBUG((LM_DEBUG, "Destroyed ORB\n"));
42 catch(const ::CORBA::Exception& ex)
44 result = 1;
45 ex._tao_print_exception ("Exception caught:");
47 catch(...)
49 result = 1;
50 ACE_ERROR ((LM_ERROR, " (%P|%t) Unknown error\n"));
53 return 0;
57 int ACE_TMAIN(int, ACE_TCHAR*[])
59 ACE_hthread_t thread1;
60 # if defined (ACE_HAS_PTHREADS)
61 pthread_create(&thread1, 0, main_orb, 0);
62 #else
63 ACE_Thread::spawn (main_orb, 0, THR_NEW_LWP|THR_JOINABLE, 0, &thread1);
64 #endif
65 ACE_Thread::join( thread1);
67 return result;