コード例 #1
0
int
run_main (int , ACE_TCHAR *[])
{
  ACE_START_TEST (ACE_TEXT ("Bug_4055_Regression_Test"));
# if defined (ACE_HAS_THREADS)
  int status = 1;

  ACE_Thread_Mutex mutex_;
  ACE_Condition_Thread_Mutex condition_ (mutex_);
  ACE_Condition_Attributes_T<ACE_Monotonic_Time_Policy> monotonic_cond_attr_;
  ACE_Condition_Thread_Mutex monotonic_condition_ (mutex_, monotonic_cond_attr_);

  if (mutex_.acquire () != 0)
  {
    ACE_ERROR ((LM_ERROR, "(%P|%t) ERROR: Failed to acquire mutex.\n"));
  }
  else
  {
    ACE_Time_Value waittime;
    waittime = waittime.now ();
    if (test_timer (condition_, waittime))
    {
      ACE_Time_Value_T<ACE_Monotonic_Time_Policy> monotonic_waittime;
      monotonic_waittime = monotonic_waittime.now ();
      if (test_timer (monotonic_condition_, monotonic_waittime, true))
        status = 0;
    }
  }
# else
  int status = 0;
# endif
  ACE_END_TEST;
  return status;
}
コード例 #2
0
ファイル: client.cpp プロジェクト: chenbk85/ACE-Middleware
 void do_upcall_excep (::Messaging::ExceptionHolder * excep )
 {
   try
     {
       excep->raise_exception ();
     }
   catch (CORBA::Exception &)
     {
     }
   ACE_DEBUG ((LM_DEBUG, "exception caught on upcall req\n"));
   upcall_end = upcall_end.now ();
 }
コード例 #3
0
ファイル: client.cpp プロジェクト: chenbk85/ACE-Middleware
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
  CORBA::ORB_var orb_;
  int result = 0;

  try
  {
    ACE_DEBUG((LM_INFO,"(%P|%t) START OF CLIENT TEST\n"));

    orb_ = CORBA::ORB_init (argc, argv);

    if (parse_args (argc, argv) != 0)
      return 1;

    CORBA::Object_var obj = orb_->resolve_initial_references ("RootPOA");
    PortableServer::POA_var root_poa =
      PortableServer::POA::_narrow (obj.in());

    PortableServer::POAManager_var poa_manager =
      root_poa->the_POAManager ();
    PortableServer::POA_var poa = root_poa;

    poa_manager->activate ();

    PortableServer::ServantBase_var cb_serv = new SharedIntfCB;
    PortableServer::ObjectId_var oid = root_poa->activate_object (cb_serv.in());
    obj = root_poa->id_to_reference (oid.in());

    Test_Idl::AMI_SharedIntfHandler_var cb =
      Test_Idl::AMI_SharedIntfHandler::_narrow (obj.in());

    obj = orb_->string_to_object ("file://server.ior");
    intf = Test_Idl::SharedIntf::_narrow(obj.in());

    ACE_DEBUG((LM_INFO,"(%P|%t) invoking async upcall.\n"));

    upcall_start = upcall_start.now ();
    intf->sendc_do_upcall (cb.in());
    ACE_DEBUG((LM_INFO,"(%P|%t) invoking ping\n"));

    ping_start = ping_start.now ();
    intf->ping ();
    ACE_DEBUG((LM_INFO,"(%P|%t) sync ping returned\n"));
    ping_end = ping_end.now ();

    result = (upcall_end > ACE_Time_Value::zero && upcall_end <= ping_end) ? 0 : 1;

    intf->farewell ();
    intf = Test_Idl::SharedIntf::_nil ();
    orb_->destroy ();

    ACE_DEBUG ((LM_INFO,"(%P|%t) Client Test %C\n",
                (result == 0 ? "succeeded":"failed")));
  }
  catch (const CORBA::Exception& ex)
  {
    ex._tao_print_exception ("Error: Exception caught:");
  }

  return result;
}
コード例 #4
0
ファイル: client.cpp プロジェクト: chenbk85/ACE-Middleware
 void do_upcall (void)
 {
   ACE_DEBUG ((LM_DEBUG, "upcall returned\n"));
   upcall_end = upcall_end.now ();
 }
コード例 #5
0
ファイル: client.cpp プロジェクト: chenbk85/ACE-Middleware
 void ping_excep (::Messaging::ExceptionHolder * )
 {
   ACE_DEBUG ((LM_DEBUG, "exception caught on ping req\n"));
   ping_end = ping_end.now ();
 }
コード例 #6
0
ファイル: client.cpp プロジェクト: chenbk85/ACE-Middleware
 void ping (void)
 {
   ACE_DEBUG ((LM_DEBUG, "ping returned\n"));
   ping_end = ping_end.now ();
 }