int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { try { CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); int result = parse_args (argc, argv); if (result != 0) return result; // Make sure we can support multiple priorities that are required // for this test. check_supported_priorities (orb.in ()); // Thread Manager for managing task. ACE_Thread_Manager thread_manager; // Create task. Task task (thread_manager, orb.in ()); // Task activation flags. long flags = THR_NEW_LWP | THR_JOINABLE | orb->orb_core ()->orb_params ()->thread_creation_flags (); // Activate task. result = task.activate (flags); ACE_ASSERT (result != -1); ACE_UNUSED_ARG (result); // Wait for task to exit. result = thread_manager.wait (); ACE_ASSERT (result != -1); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Exception caught:"); return -1; } return 0; }
int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { int result = 0; try { // Standard initialization: // parse arguments and get all the references (ORB, // RootPOA, RTORB, RTCurrent, POAManager). CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); if (parse_args (argc, argv) != 0) return -1; // Make sure we can support multiple priorities that are required // for this test. if (!check_supported_priorities (orb.in ())) return 2; // Thread Manager for managing task. ACE_Thread_Manager thread_manager; // Create task. Task task (thread_manager, orb.in ()); // Task activation flags. long flags = THR_NEW_LWP | THR_JOINABLE | orb->orb_core ()->orb_params ()->thread_creation_flags (); // Activate task. result = task.activate (flags); if (result == -1) { if (errno == EPERM) { ACE_ERROR_RETURN ((LM_ERROR, "Cannot create thread with scheduling policy %s\n" "because the user does not have the appropriate privileges, terminating program....\n" "Check svc.conf options and/or run as root\n", sched_policy_name (orb->orb_core ()->orb_params ()->ace_sched_policy ())), 2); } else // Unexpected error. ACE_ERROR_RETURN ((LM_ERROR, "ERROR: Cannot create thread. errno = %d\n", ACE_ERRNO_GET), -1); } // Wait for task to exit. result = thread_manager.wait (); } catch (const ::CORBA::Exception & ex) { ex._tao_print_exception( "Exception caught:"); return -1; } return result; }
int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { try { // Initialize the ORB, resolve references and parse arguments. // ORB. CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); // Parse arguments. if (parse_args (argc, argv) != 0) return -1; // Make sure we can support multiple priorities that are required // for this test. if (!check_supported_priorities (orb.in ())) return 2; // Thread Manager for managing task. ACE_Thread_Manager thread_manager; // Create task. Task task (thread_manager, orb.in ()); // Task activation flags. long flags = THR_NEW_LWP | THR_JOINABLE | orb->orb_core ()->orb_params ()->thread_creation_flags (); // Activate task. int result = task.activate (flags); if (result == -1) { if (errno == EPERM) { ACE_ERROR_RETURN ((LM_ERROR, "Cannot create thread with scheduling policy %s\n" "because the user does not have the appropriate privileges, terminating program....\n" "Check svc.conf options and/or run as root\n", sched_policy_name (orb->orb_core ()->orb_params ()->ace_sched_policy ())), 2); } else // Unexpected error. ACE_ASSERT (0); } // Wait for task to exit. result = thread_manager.wait (); ACE_ASSERT (result != -1); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ( "Unexpected exception in MT_Client_Protocol_Priority test client:"); return -1; } return 0; }
int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { try { CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); int result = parse_args (argc, argv); if (result != 0) return result; // Make sure we can support multiple priorities that are required // for this test. if (!check_supported_priorities (orb.in ())) return 2; // The following finds out the lowest priority for this // scheduling policy. This will give us the biggest range on NT // since the default priority is 0 where as the lowest priority // is -15. int minimum_priority = ACE_Sched_Params::priority_min (orb->orb_core ()->orb_params ()->ace_sched_policy ()); // Thread Manager for managing task. ACE_Thread_Manager thread_manager; // Create task. Task task (thread_manager, orb.in ()); // Task activation flags. long flags = THR_NEW_LWP | THR_JOINABLE | orb->orb_core ()->orb_params ()->thread_creation_flags (); // Activate task. result = task.activate (flags, 1, 0, minimum_priority); if (result == -1) { if (errno == EPERM) { ACE_ERROR_RETURN ((LM_ERROR, "Cannot create thread with scheduling policy %C\n" "because the user does not have the appropriate privileges, terminating program....\n" "Check svc.conf options and/or run as root\n", sched_policy_name (orb->orb_core ()->orb_params ()->ace_sched_policy ())), 2); } else // Unexpected error. ACE_ASSERT (0); } // Wait for task to exit. result = thread_manager.wait (); ACE_ASSERT (result != -1); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Unexpected exception!"); return -1; } return 0; }
int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { int result = 0; try { // Register the interceptors to check for the RTCORBA // service contexts in the reply messages. PortableInterceptor::ORBInitializer_ptr temp_initializer; ACE_NEW_RETURN (temp_initializer, Client_ORBInitializer, -1); // No exceptions yet! PortableInterceptor::ORBInitializer_var initializer = temp_initializer; PortableInterceptor::register_orb_initializer (initializer.in ()); // Initialize and obtain reference to the Test object. CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); if (parse_args (argc, argv) != 0) return -1; // Make sure we can support multiple priorities that are required // for this test. if (!check_supported_priorities (orb.in ())) return 2; // Thread Manager for managing task. ACE_Thread_Manager thread_manager; // Create task. Task task (thread_manager, orb.in ()); // Task activation flags. long flags = THR_NEW_LWP | THR_JOINABLE | orb->orb_core ()->orb_params ()->thread_creation_flags (); // Activate task. result = task.activate (flags); if (result == -1) { if (errno == EPERM) { ACE_ERROR_RETURN ((LM_ERROR, "Cannot create thread with scheduling policy %s\n" "because the user does not have the appropriate privileges, terminating program....\n" "Check svc.conf options and/or run as root\n", sched_policy_name (orb->orb_core ()->orb_params ()->ace_sched_policy ())), 2); } else // Unexpected error. ACE_ERROR_RETURN ((LM_ERROR, "ERROR: Cannot create thread. errno = %d\n", ACE_ERRNO_GET), -1); } // Wait for task to exit. result = thread_manager.wait (); } catch (const CORBA::Exception & ae) { ae._tao_print_exception ( "Caught exception:"); return -1; } return result; }