rt_orb.cpp
来自「这是广泛使用的通信开源项目,对于大容量,高并发的通讯要求完全能够胜任,他广泛可用」· C++ 代码 · 共 478 行 · 第 1/2 页
CPP
478 行
CORBA::Boolean keep_alive,
CORBA::Boolean dont_route,
CORBA::Boolean no_delay,
CORBA::Boolean enable_network_priority
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException ))
{
TAO_TCP_Properties *tmp;
ACE_NEW_THROW_EX (tmp,
TAO_TCP_Properties (send_buffer_size,
recv_buffer_size,
keep_alive,
dont_route,
no_delay,
enable_network_priority),
CORBA::NO_MEMORY (TAO_DEFAULT_MINOR_CODE,
CORBA::COMPLETED_NO));
ACE_CHECK_RETURN (RTCORBA::TCPProtocolProperties::_nil ());
return tmp;
}
RTCORBA::ThreadpoolId
TAO_RT_ORB::create_threadpool (CORBA::ULong stacksize,
CORBA::ULong static_threads,
CORBA::ULong dynamic_threads,
RTCORBA::Priority default_priority,
CORBA::Boolean allow_request_buffering,
CORBA::ULong max_buffered_requests,
CORBA::ULong max_request_buffer_size
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
return this->tp_manager_->create_threadpool (stacksize,
static_threads,
dynamic_threads,
default_priority,
allow_request_buffering,
max_buffered_requests,
max_request_buffer_size
ACE_ENV_ARG_PARAMETER);
}
RTCORBA::ThreadpoolId
TAO_RT_ORB::create_threadpool_with_lanes (CORBA::ULong stacksize,
const RTCORBA::ThreadpoolLanes &lanes,
CORBA::Boolean allow_borrowing,
CORBA::Boolean allow_request_buffering,
CORBA::ULong max_buffered_requests,
CORBA::ULong max_request_buffer_size
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
return this->tp_manager_->create_threadpool_with_lanes (stacksize,
lanes,
allow_borrowing,
allow_request_buffering,
max_buffered_requests,
max_request_buffer_size
ACE_ENV_ARG_PARAMETER);
}
void
TAO_RT_ORB::destroy_threadpool (RTCORBA::ThreadpoolId threadpool
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
RTCORBA::RTORB::InvalidThreadpool))
{
this->tp_manager_->destroy_threadpool (threadpool
ACE_ENV_ARG_PARAMETER);
}
RTCORBA::PriorityModelPolicy_ptr
TAO_RT_ORB::create_priority_model_policy (RTCORBA::PriorityModel priority_model,
RTCORBA::Priority server_priority
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
TAO_PriorityModelPolicy *tmp;
ACE_NEW_THROW_EX (tmp,
TAO_PriorityModelPolicy (priority_model, server_priority),
CORBA::NO_MEMORY (TAO_DEFAULT_MINOR_CODE,
CORBA::COMPLETED_NO));
ACE_CHECK_RETURN (RTCORBA::PriorityModelPolicy::_nil ());
return tmp;
}
RTCORBA::ThreadpoolPolicy_ptr
TAO_RT_ORB::create_threadpool_policy (RTCORBA::ThreadpoolId threadpool
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
TAO_ThreadpoolPolicy *tmp;
ACE_NEW_THROW_EX (tmp,
TAO_ThreadpoolPolicy (threadpool),
CORBA::NO_MEMORY (TAO_DEFAULT_MINOR_CODE,
CORBA::COMPLETED_NO));
ACE_CHECK_RETURN (RTCORBA::ThreadpoolPolicy::_nil ());
return tmp;
}
RTCORBA::PriorityBandedConnectionPolicy_ptr
TAO_RT_ORB::create_priority_banded_connection_policy (const
RTCORBA::PriorityBands & priority_bands
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
TAO_PriorityBandedConnectionPolicy *tmp;
ACE_NEW_THROW_EX (tmp,
TAO_PriorityBandedConnectionPolicy (priority_bands),
CORBA::NO_MEMORY (TAO_DEFAULT_MINOR_CODE,
CORBA::COMPLETED_NO));
ACE_CHECK_RETURN (RTCORBA::PriorityBandedConnectionPolicy::_nil ());
return tmp;
}
RTCORBA::PrivateConnectionPolicy_ptr
TAO_RT_ORB::create_private_connection_policy (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
TAO_PrivateConnectionPolicy *tmp;
ACE_NEW_THROW_EX (tmp,
TAO_PrivateConnectionPolicy (),
CORBA::NO_MEMORY (TAO_DEFAULT_MINOR_CODE,
CORBA::COMPLETED_NO));
ACE_CHECK_RETURN (RTCORBA::PrivateConnectionPolicy::_nil ());
return tmp;
}
RTCORBA::ServerProtocolPolicy_ptr
TAO_RT_ORB::create_server_protocol_policy (const RTCORBA::ProtocolList & protocols
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
TAO_ServerProtocolPolicy *tmp;
ACE_NEW_THROW_EX (tmp,
TAO_ServerProtocolPolicy (protocols),
CORBA::NO_MEMORY (TAO_DEFAULT_MINOR_CODE,
CORBA::COMPLETED_NO));
ACE_CHECK_RETURN (RTCORBA::ServerProtocolPolicy::_nil ());
return tmp;
}
RTCORBA::ClientProtocolPolicy_ptr
TAO_RT_ORB::create_client_protocol_policy (const RTCORBA::ProtocolList & protocols
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
TAO_ClientProtocolPolicy *tmp;
ACE_NEW_THROW_EX (tmp,
TAO_ClientProtocolPolicy (protocols),
CORBA::NO_MEMORY (TAO_DEFAULT_MINOR_CODE,
CORBA::COMPLETED_NO));
ACE_CHECK_RETURN (RTCORBA::ClientProtocolPolicy::_nil ());
return tmp;
}
TAO_Thread_Pool_Manager &
TAO_RT_ORB::tp_manager (void)
{
return *this->tp_manager_;
}
/* static */
int
TAO_RT_ORB::modify_thread_scheduling_policy (CORBA::ORB_ptr orb)
{
//
// This method changes the scheduling policy of the calling thread
// to match the scheduling policy specified in the svc.conf file.
// The priority of the calling thread will be set to the minimum
// priority supported by that scheduling policy.
//
// This method make sense on those platform (e.g., Linux) where
// PTHREAD_SCOPE_SYSTEM is the only scheduling scope supported. On
// other platforms, this method is a no-op since the only way to get
// the real-time threading behavior is to setup the
// PTHREAD_SCOPE_SYSTEM scheduling scope when a thread is being
// created. On such platforms, one can set the correct scheduling
// scope and policy when creating the thread, thus not needing to
// use this method.
//
#if defined (linux)
int sched_policy =
orb->orb_core ()->orb_params ()->ace_sched_policy ();
int minimum_priority =
ACE_Sched_Params::priority_min (sched_policy);
ACE_hthread_t thread_id;
ACE_Thread::self (thread_id);
return ACE_Thread::setprio (thread_id,
minimum_priority,
sched_policy);
#else /* linux */
ACE_UNUSED_ARG (orb);
ACE_NOTSUP_RETURN (-1);
#endif /* linux */
}
////////////////////////////////////////////////////////////////////////////////
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
#if (TAO_HAS_NAMED_RT_MUTEXES == 1)
template class ACE_Hash_Map_Manager_Ex<ACE_CString, RTCORBA::Mutex_var, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>;
template class ACE_Hash_Map_Iterator_Base_Ex<ACE_CString, RTCORBA::Mutex_var, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>;
template class ACE_Hash_Map_Iterator_Ex<ACE_CString, RTCORBA::Mutex_var, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>;
template class ACE_Hash_Map_Reverse_Iterator_Ex<ACE_CString, RTCORBA::Mutex_var, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>;
template class ACE_Hash_Map_Entry<ACE_CString, RTCORBA::Mutex_var>;
#endif /* TAO_HAS_NAMED_RT_MUTEXES == 1 */
#elif defined(ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
#if (TAO_HAS_NAMED_RT_MUTEXES == 1)
#pragma instantiate ACE_Hash_Map_Manager_Ex<ACE_CString, RTCORBA::Mutex_var, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>
#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<ACE_CString, RTCORBA::Mutex_var, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>
#pragma instantiate ACE_Hash_Map_Iterator_Ex<ACE_CString, RTCORBA::Mutex_var, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>
#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<ACE_CString, RTCORBA::Mutex_var, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>
#pragma instantiate ACE_Hash_Map_Entry<ACE_CString, RTCORBA::Mutex_var>
#endif /* TAO_HAS_NAMED_RT_MUTEXES == 1 */
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
#endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?