本文整理匯總了C++中ACE_UNUSED_ARG函數的典型用法代碼示例。如果您正苦於以下問題:C++ ACE_UNUSED_ARG函數的具體用法?C++ ACE_UNUSED_ARG怎麽用?C++ ACE_UNUSED_ARG使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了ACE_UNUSED_ARG函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: run_main
int
run_main (int argc, ACE_TCHAR *argv[])
{
ACE_START_TEST (ACE_TEXT ("MT_Reference_Counted_Event_Handler_Test"));
// Validate options.
int result =
parse_args (argc, argv);
if (result != 0)
return result;
disable_signal (SIGPIPE, SIGPIPE);
int ignore_nested_upcalls = 1;
int perform_nested_upcalls = 0;
int event_loop_thread_required = 1;
int event_loop_thread_not_required = 0;
if (test_select_reactor)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("\n\n(%t) Testing Select Reactor....\n\n")));
test<ACE_Select_Reactor> test (ignore_nested_upcalls,
event_loop_thread_not_required);
ACE_UNUSED_ARG (test);
}
if (test_tp_reactor)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("\n\n(%t) Testing TP Reactor....\n\n")));
test<ACE_TP_Reactor> test (perform_nested_upcalls,
event_loop_thread_not_required);
ACE_UNUSED_ARG (test);
}
#if defined (ACE_HAS_EVENT_POLL)
if (test_dev_poll_reactor)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("\n\n(%t) Testing Dev Poll Reactor....\n\n")));
test<ACE_Dev_Poll_Reactor> test (perform_nested_upcalls,
event_loop_thread_not_required);
ACE_UNUSED_ARG (test);
}
#endif
#if defined (ACE_WIN32)
if (test_wfmo_reactor)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("\n\n(%t) Testing WFMO Reactor....\n\n")));
test<ACE_WFMO_Reactor> test (ignore_nested_upcalls,
event_loop_thread_required);
ACE_UNUSED_ARG (test);
}
#else /* ACE_WIN32 */
ACE_UNUSED_ARG (event_loop_thread_required);
#endif /* ACE_WIN32 */
ACE_END_TEST;
return 0;
}
示例2: ACE_DEBUG
int
Invocation_Thread::svc (void)
{
int connection_counter = 0;
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT("(%t) Invocation_Thread::svc commencing\n")));
disable_signal (SIGPIPE, SIGPIPE);
for (int message_counter = 1;; ++message_counter)
{
// Get a connection from the cache.
Sender *sender =
this->connection_cache_.acquire_connection ();
// If no connection is available in the cache, create a new one.
if (sender == 0)
{
if (connection_counter < number_of_connections)
{
sender = this->create_connection ();
// This lets the Close_Socket_Thread know that the new
// connection has been created.
int result =
this->new_connection_event_.signal ();
ACE_TEST_ASSERT (result == 0);
ACE_UNUSED_ARG (result);
++connection_counter;
message_counter = 1;
}
else
// Stop the thread, if the maximum number of connections
// for the test has been reached.
break;
}
// The reference count on the sender was increased by the cache
// before it was returned to us.
ACE_Event_Handler_var safe_sender (sender);
// If the test does not require making invocations, immediately
// release the connection.
if (!this->make_invocations_)
{
this->connection_cache_.release_connection (sender);
// Sleep for a short while
ACE_OS::sleep (ACE_Time_Value (0, 10 * 1000));
}
else
{
// Make invocation.
ssize_t result =
sender->send_message ();
// If successful, release connection.
if (result == message_size)
{
if (debug)
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%t) Message %d:%d delivered on handle %d\n"),
connection_counter,
message_counter,
sender->handle_));
this->connection_cache_.release_connection (sender);
}
else
{
// If failure in making invocation, close the sender.
if (debug)
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%t) /*** Problem in delivering message ")
ACE_TEXT ("%d:%d on handle %d: shutting down ")
ACE_TEXT ("invocation thread ***/\n"),
connection_counter,
message_counter,
sender->handle_));
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%t) Invocation thread calling ")
ACE_TEXT ("Sender::close() for handle %d\n"),
sender->handle_));
sender->close ();
}
}
}
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT("(%t) Invocation_Thread::svc calling end_reactor_event_loop\n")));
// Close the Reactor event loop.
this->reactor_.end_reactor_event_loop ();
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT("(%t) Invocation_Thread::svc terminating\n")));
return 0;
}
示例3: ACE_UNUSED_ARG
ACE_Proactor *
ACE_Proactor::instance (size_t threads)
{
ACE_UNUSED_ARG (threads);
return 0;
}
示例4: ACE_UNUSED_ARG
int
STDIN_Token::handle_input (ACE_HANDLE fd)
{
ACE_UNUSED_ARG (fd);
char tid[BUFSIZ];
char token[BUFSIZ];
char type[16];
char operation[16];
if (::scanf ("%s %s %s %s", tid, token, type, operation) <= 0)
{
ACE_OS::printf ("Try again.\n");
return 0;
}
ACE_Token_Proxy *proxy =
this->get_proxy (tid, token, type[0]);
if (proxy == 0)
return -1;
switch (operation[0])
{
case 'a':
case 'A':
if (proxy->acquire () == 0)
{
ACE_OS::printf ("Succeeded.\n");
if (ACE_TOKEN_INVARIANTS::instance ()->acquired (proxy) == 0)
ACE_OS::printf ("Violated invariant.\n");
}
else
ACE_ERROR ((LM_ERROR, "%p.\n", "Acquire failed"));
break;
case 'n':
case 'N':
ACE_TOKEN_INVARIANTS::instance ()->releasing (proxy);
if (proxy->renew () == 0)
{
ACE_OS::printf ("Succeeded.\n");
if (ACE_TOKEN_INVARIANTS::instance ()->acquired (proxy) == 0)
ACE_OS::printf ("Violated invariant.\n");
}
else
ACE_ERROR ((LM_ERROR, "%p.\n", "Renew failed"));
break;
case 'r':
case 'R':
ACE_TOKEN_INVARIANTS::instance ()->releasing (proxy);
if (proxy->release () == 0)
ACE_OS::printf ("Succeeded.\n");
else
ACE_ERROR ((LM_ERROR, "%p.\n", "Release failed"));
break;
case 't':
case 'T':
if (proxy->tryacquire () == 0)
{
ACE_OS::printf ("Succeeded.\n");
if (ACE_TOKEN_INVARIANTS::instance ()->acquired (proxy) == 0)
ACE_OS::printf ("Violated invariant.\n");
}
else
ACE_ERROR ((LM_ERROR, "%p.\n", "Tryacquire failed"));
break;
}
this->display_menu ();
return 0;
}
示例5: ACE_TMAIN
int
ACE_TMAIN(int, ACE_TCHAR ** argv)
{
int result = 0;
#if !defined (ACE_LACKS_FORK)
ACE_Sig_Action sigUSR2((ACE_SignalHandler) shutdown_func, SIGUSR2);
ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%P|%t) SIGUSR2 shutdown handler installed\n")));
ACE_UNUSED_ARG(sigUSR2);
pid_t pid = -1;
pid = ACE_OS::fork();
ACE_Log_Msg::instance ()->sync (argv[0]); // Make %P|%t work right
if (pid == 0) // child
{
ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%P|%t) child waiting\n")));
ACE_OS::sleep(5);
ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%P|%t) signaling parent\n")));
result = ACE_OS::kill(ACE_OS::getppid(), SIGUSR2);
ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%P|%t) signaled parent\n")));
// ACE_OS::sleep (100000);
return 0;
}
else if (pid > 0) // parent
{
ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%P|%t) parent using ACE_Service_Config, pid=%d\n"), pid));
ACE_Service_Config serviceConfig;
ACE_TCHAR signum[64];
ACE_OS::sprintf(signum, ACE_TEXT("%d"), SIGUSR1);
ACE_ARGV args;
args.add(argv[0]);
args.add(ACE_TEXT("-s"));
args.add(signum);
result = serviceConfig.open (
args.argc(),
args.argv(),
ACE_DEFAULT_LOGGER_KEY,
1, // ignore_static_svcs = 1,
1, // ignore_default_svc_conf_file = 0,
0 // ignore_debug_flag = 0
);
if(0 != result)
{
ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) Error: serviceConfig.open failed\n")));
return result;
}
ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%P|%t) serviceConfig.open done\n")));
ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%P|%t) serviceConfig.process_file ...\n")));
#if (ACE_USES_CLASSIC_SVC_CONF == 1)
result = serviceConfig.process_file(ACE_TEXT("Bug_3251.conf"));
#else
result = serviceConfig.process_file(ACE_TEXT("Bug_3251.conf.xml"));
#endif
if(0 != result)
{
ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) Error: serviceConfig.process_file failed\n")));
return result;
}
ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%P|%t) serviceConfig.process_file done\n")));
ACE_DEBUG ((LM_INFO, ACE_TEXT ("run_event_loop ...\n")));
while(!bShutdown)
{
ACE_OS::last_error(0);
result = ACE_Reactor::run_event_loop();
// reenter loop on EINTR
if(0 != result && EINTR == ACE_OS::last_error())
{
if(bShutdown)
break;
}
else if(0 != result)
{
ACE_DEBUG ((
LM_INFO,
ACE_TEXT ("(%P|%t) run_event_loop failed (%s, %d)\n"),
ACE_OS::strerror(ACE_OS::last_error()),
ACE_OS::last_error()
));
}
}
ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%P|%t) run_event_loop done\n")));
ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%P|%t) serviceConfig.fini_svcs ...\n")));
result = serviceConfig.fini_svcs();
if(0 != result)
{
ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) Error: serviceConfig.fini_svcs failed\n")));
return result;
}
ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%P|%t) serviceConfig.fini_svcs done\n")));
ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%P|%t) serviceConfig.close ...\n")));
result = serviceConfig.close();
if(0 != result)
//.........這裏部分代碼省略.........
示例6: run_main
int
run_main (int argc, ACE_TCHAR *argv[])
{
ACE_START_TEST (ACE_TEXT ("MT_Reference_Counted_Notify_Test"));
// Validate options.
int result =
parse_args (argc, argv);
if (result != 0)
return result;
int extra_iterations_needed = 1;
int extra_iterations_not_needed = 0;
if (test_select_reactor)
{
ACE_DEBUG ((LM_DEBUG,
"\n\nTesting Select Reactor....\n\n"));
test<ACE_Select_Reactor> test (extra_iterations_not_needed);
ACE_UNUSED_ARG (test);
}
if (test_tp_reactor)
{
ACE_DEBUG ((LM_DEBUG,
"\n\nTesting TP Reactor....\n\n"));
test<ACE_TP_Reactor> test (extra_iterations_not_needed);
ACE_UNUSED_ARG (test);
}
#if defined (ACE_HAS_EVENT_POLL)
if (test_dev_poll_reactor)
{
ACE_DEBUG ((LM_DEBUG,
"\n\nTesting Dev Poll Reactor....\n\n"));
test<ACE_Dev_Poll_Reactor> test (extra_iterations_not_needed);
ACE_UNUSED_ARG (test);
}
#endif
#if defined (ACE_WIN32)
if (test_wfmo_reactor)
{
ACE_DEBUG ((LM_DEBUG,
"\n\nTesting WFMO Reactor....\n\n"));
test<ACE_WFMO_Reactor> test (extra_iterations_needed);
ACE_UNUSED_ARG (test);
}
#else /* ACE_WIN32 */
ACE_UNUSED_ARG (extra_iterations_needed);
#endif /* ACE_WIN32 */
ACE_END_TEST;
return 0;
}
示例7: ACE_TRACE
template <typename SVC_HANDLER, typename PEER_CONNECTOR> int
ACE_Strategy_Connector<SVC_HANDLER, PEER_CONNECTOR>::open
(ACE_Reactor *r,
ACE_Creation_Strategy<SVC_HANDLER> *cre_s,
ACE_Connect_Strategy<SVC_HANDLER, PEER_CONNECTOR> *conn_s,
ACE_Concurrency_Strategy<SVC_HANDLER> *con_s,
int flags)
{
ACE_TRACE ("ACE_Strategy_Connector<SVC_HANDLER, PEER_CONNECTOR>::open");
this->reactor (r);
// @@ Not implemented yet.
// this->flags_ = flags;
ACE_UNUSED_ARG (flags);
// Initialize the creation strategy.
// First we decide if we need to clean up.
if (this->creation_strategy_ != 0 &&
this->delete_creation_strategy_ &&
cre_s != 0)
{
delete this->creation_strategy_;
this->creation_strategy_ = 0;
this->delete_creation_strategy_ = false;
}
if (cre_s != 0)
this->creation_strategy_ = cre_s;
else if (this->creation_strategy_ == 0)
{
ACE_NEW_RETURN (this->creation_strategy_,
CREATION_STRATEGY (0, r),
-1);
this->delete_creation_strategy_ = true;
}
// Initialize the accept strategy.
if (this->connect_strategy_ != 0 &&
this->delete_connect_strategy_ &&
conn_s != 0)
{
delete this->connect_strategy_;
this->connect_strategy_ = 0;
this->delete_connect_strategy_ = false;
}
if (conn_s != 0)
this->connect_strategy_ = conn_s;
else if (this->connect_strategy_ == 0)
{
ACE_NEW_RETURN (this->connect_strategy_,
CONNECT_STRATEGY,
-1);
this->delete_connect_strategy_ = true;
}
// Initialize the concurrency strategy.
if (this->concurrency_strategy_ != 0 &&
this->delete_concurrency_strategy_ &&
con_s != 0)
{
delete this->concurrency_strategy_;
this->concurrency_strategy_ = 0;
this->delete_concurrency_strategy_ = false;
}
if (con_s != 0)
this->concurrency_strategy_ = con_s;
else if (this->concurrency_strategy_ == 0)
{
ACE_NEW_RETURN (this->concurrency_strategy_,
CONCURRENCY_STRATEGY,
-1);
this->delete_concurrency_strategy_ = true;
}
return 0;
}
示例8: ACE_UNUSED_ARG
void
TAO_EC_Filter::get_qos_info (TAO_EC_QOS_Info& qos_info)
{
ACE_UNUSED_ARG (qos_info);
throw CORBA::NO_IMPLEMENT (TAO::VMCID, CORBA::COMPLETED_NO);
}
示例9: ACE_TRACE
int
ACE_ATM_Connector::connect (ACE_ATM_Stream &new_stream,
const ACE_ATM_Addr &remote_sap,
ACE_ATM_Params params,
ACE_ATM_QoS options,
ACE_Time_Value *timeout,
const ACE_ATM_Addr &local_sap,
int reuse_addr,
int flags,
int perms)
{
ACE_TRACE ("ACE_ATM_Connector::connect");
#if defined (ACE_HAS_FORE_ATM_XTI)
return connector_.connect(new_stream.get_stream(),
remote_sap,
timeout,
local_sap,
reuse_addr,
flags,
perms,
params.get_device(),
params.get_info(),
params.get_rw_flag(),
params.get_user_data(),
&options.get_qos());
#elif defined (ACE_HAS_FORE_ATM_WS2)
ACE_DEBUG(LM_DEBUG,
ACE_TEXT ("ATM_Connector(connect): set QoS parameters\n" ));
ACE_HANDLE s = new_stream.get_handle();
struct sockaddr_atm *saddr = ( struct sockaddr_atm *)remote_sap.get_addr();
ACE_QoS cqos = options.get_qos();
ACE_QoS_Params qos_params = ACE_QoS_Params(0,
0,
&cqos,
0,
0);
ACE_DEBUG(LM_DEBUG,
ACE_TEXT ("ATM_Connector(connect): connecting...\n"));
int result = ACE_OS::connect( s,
( struct sockaddr *)saddr,
sizeof( struct sockaddr_atm ),
qos_params );
if( result != 0 )
ACE_OS::printf( "ATM_Connector(connect): connection failed, %d\n",
::WSAGetLastError());
return result;
#elif defined (ACE_HAS_LINUX_ATM)
ACE_UNUSED_ARG (params);
ACE_UNUSED_ARG (timeout);
ACE_UNUSED_ARG (reuse_addr);
ACE_UNUSED_ARG (perms);
ACE_UNUSED_ARG (flags);
ACE_HANDLE handle = new_stream.get_handle();
ATM_QoS qos =options.get_qos();
ATM_Addr *local_addr=(ATM_Addr*)local_sap.get_addr(),
*remote_addr=(ATM_Addr*)remote_sap.get_addr();
if(ACE_OS::setsockopt(handle,
SOL_ATM,
SO_ATMSAP,
reinterpret_cast<char*> (&(local_addr->atmsap)),
sizeof(local_addr->atmsap)) < 0) {
ACE_OS::printf( "ATM_Connector(connect): unable to set atmsap %d\nContinuing...",
errno);
}
if(ACE_OS::setsockopt(handle,
SOL_ATM,
SO_ATMQOS,
reinterpret_cast<char*> (&qos),
sizeof(qos)) < 0) {
ACE_DEBUG((LM_DEBUG,ACE_TEXT ("ATM_Connector(connect): unable to set qos %d\n"),
errno));
return -1;
}
int result = ACE_OS::connect(handle,
(struct sockaddr *)&(remote_addr->sockaddratmsvc),
sizeof( remote_addr->sockaddratmsvc));
if( result != 0 )
ACE_DEBUG(LM_DEBUG,
ACE_TEXT ("ATM_Connector(connect): connection failed, %d\n"),
errno);
return result;
#else
ACE_UNUSED_ARG (new_stream);
ACE_UNUSED_ARG (remote_sap);
ACE_UNUSED_ARG (params);
ACE_UNUSED_ARG (options);
ACE_UNUSED_ARG (timeout);
ACE_UNUSED_ARG (local_sap);
ACE_UNUSED_ARG (reuse_addr);
//.........這裏部分代碼省略.........
示例10: defined
ACE_Mutex::ACE_Mutex (int type, const ACE_TCHAR *name,
ACE_mutexattr_t *arg, mode_t mode)
:
#if defined (ACE_HAS_PTHREADS) || defined(ACE_HAS_STHREADS)
process_lock_ (0),
lockname_ (0),
#endif /* ACE_HAS_PTHREADS || ACE_HAS_STHREADS */
removed_ (false)
{
// ACE_TRACE ("ACE_Mutex::ACE_Mutex");
// These platforms need process-wide mutex to be in shared memory.
#if defined(ACE_HAS_PTHREADS) || defined (ACE_HAS_STHREADS)
if (type == USYNC_PROCESS)
{
// Let's see if the shared memory entity already exists.
ACE_HANDLE fd = ACE_OS::shm_open (name, O_RDWR | O_CREAT | O_EXCL, mode);
if (fd == ACE_INVALID_HANDLE)
{
if (errno == EEXIST)
fd = ACE_OS::shm_open (name, O_RDWR | O_CREAT, mode);
else
return;
}
else
{
// We own this shared memory object! Let's set its size.
if (ACE_OS::ftruncate (fd,
sizeof (ACE_mutex_t)) == -1)
{
ACE_OS::close (fd);
return;
}
this->lockname_ = ACE_OS::strdup (name);
if (this->lockname_ == 0)
{
ACE_OS::close (fd);
return;
}
}
this->process_lock_ =
(ACE_mutex_t *) ACE_OS::mmap (0,
sizeof (ACE_mutex_t),
PROT_RDWR,
MAP_SHARED,
fd,
0);
ACE_OS::close (fd);
if (this->process_lock_ == MAP_FAILED)
return;
if (this->lockname_
&& ACE_OS::mutex_init (this->process_lock_,
type,
name,
arg) != 0)
{
ACELIB_ERROR ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_Mutex::ACE_Mutex")));
return;
}
}
else
{
// local mutex init if USYNC_PROCESS flag is not enabled.
#else
ACE_UNUSED_ARG (mode);
#endif /* ACE_HAS_PTHREADS || ACE_HAS_STHREADS */
if (ACE_OS::mutex_init (&this->lock_,
type,
name,
arg) != 0)
ACELIB_ERROR ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_Mutex::ACE_Mutex")));
#if defined(ACE_HAS_PTHREADS) || defined (ACE_HAS_STHREADS)
}
#endif /* ACE_HAS_PTHREADS || ACE_HAS_STHREADS */
}
示例11: ACE_UNUSED_ARG
template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> int
ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::check_hint_i
(SVC_HANDLER *&sh,
const ACE_PEER_CONNECTOR_ADDR &remote_addr,
ACE_Time_Value *timeout,
const ACE_PEER_CONNECTOR_ADDR &local_addr,
bool reuse_addr,
int flags,
int perms,
ACE_Hash_Map_Entry<ACE_Refcounted_Hash_Recyclable<ACE_PEER_CONNECTOR_ADDR>, std::pair<SVC_HANDLER *, ATTRIBUTES> > *&entry,
int &found)
{
ACE_UNUSED_ARG (remote_addr);
ACE_UNUSED_ARG (timeout);
ACE_UNUSED_ARG (local_addr);
ACE_UNUSED_ARG (reuse_addr);
ACE_UNUSED_ARG (flags);
ACE_UNUSED_ARG (perms);
found = 0;
// Get the recycling act for the svc_handler
CONNECTION_CACHE_ENTRY *possible_entry =
(CONNECTION_CACHE_ENTRY *) sh->recycling_act ();
// Check to see if the hint svc_handler has been closed down
if (possible_entry->ext_id_.recycle_state () == ACE_RECYCLABLE_CLOSED)
{
// If close, decrement refcount
if (possible_entry->ext_id_.decrement () == 0)
{
// If refcount goes to zero, close down the svc_handler
possible_entry->int_id_.first->recycler (0, 0);
possible_entry->int_id_.first->close ();
this->purge_i (possible_entry);
}
// Hint not successful
found = 0;
// Reset hint
sh = 0;
}
// If hint is not closed, see if it is connected to the correct
// address and is recyclable
else if ((possible_entry->ext_id_.recycle_state () == ACE_RECYCLABLE_IDLE_AND_PURGABLE ||
possible_entry->ext_id_.recycle_state () == ACE_RECYCLABLE_IDLE_BUT_NOT_PURGABLE) &&
possible_entry->ext_id_.subject () == remote_addr)
{
// Hint successful
found = 1;
// Tell the <svc_handler> that it should prepare itself for
// being recycled.
this->prepare_for_recycling (sh);
//
// Update the caching attributes directly since we don't do a
// find() on the cache map.
//
// Indicates successful find.
int find_result = 0;
int result = this->caching_strategy ().notify_find (find_result,
possible_entry->int_id_.second);
if (result == -1)
return result;
}
else
{
// This hint will not be used.
possible_entry->ext_id_.decrement ();
// Hint not successful
found = 0;
// If <sh> is not connected to the correct address or is busy,
// we will not use it.
sh = 0;
}
if (found)
entry = possible_entry;
return 0;
}
示例12: ACE_TRACE
// returns -2 when the hostname is truncated
int
ACE_INET_Addr::get_host_name_i (char hostname[], size_t len) const
{
ACE_TRACE ("ACE_INET_Addr::get_host_name_i");
#if defined (ACE_HAS_IPV6)
if ((this->get_type () == PF_INET6 &&
0 == ACE_OS::memcmp (&this->inet_addr_.in6_.sin6_addr,
&in6addr_any,
sizeof (this->inet_addr_.in6_.sin6_addr)))
||
(this->get_type () == PF_INET &&
this->inet_addr_.in4_.sin_addr.s_addr == INADDR_ANY))
#else
if (this->inet_addr_.in4_.sin_addr.s_addr == INADDR_ANY)
#endif /* ACE_HAS_IPV6 */
{
if (ACE_OS::hostname (hostname, len) == -1)
return -1;
else
return 0;
}
else
{
#if defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYADDR)
ACE_UNUSED_ARG (len);
int error =
::hostGetByAddr ((int) this->inet_addr_.in4_.sin_addr.s_addr,
hostname);
if (error == OK)
return 0;
else
{
errno = error;
return -1;
}
#else
void* addr = this->ip_addr_pointer ();
int size = this->ip_addr_size ();
int type = this->get_type ();
# if defined (ACE_HAS_IPV6) && defined (ACE_HAS_BROKEN_GETHOSTBYADDR_V4MAPPED)
// Most OS can not handle IPv6-mapped-IPv4 addresses (even
// though they are meant to) so map them back to IPv4 addresses
// before trying to resolve them
in_addr demapped_addr;
if (type == PF_INET6 &&
(this->is_ipv4_mapped_ipv6 () || this->is_ipv4_compat_ipv6 ()))
{
ACE_OS::memcpy (&demapped_addr.s_addr, &this->inet_addr_.in6_.sin6_addr.s6_addr[12], 4);
addr = &demapped_addr;
size = sizeof(demapped_addr);
type = PF_INET;
}
# endif /* ACE_HAS_IPV6 */
int h_error; // Not the same as errno!
hostent hentry;
ACE_HOSTENT_DATA buf;
hostent * const hp =
ACE_OS::gethostbyaddr_r (static_cast <char *> (addr),
size,
type,
&hentry,
buf,
&h_error);
if (hp == 0 || hp->h_name == 0)
return -1;
if (ACE_OS::strlen (hp->h_name) >= len)
{
// We know the length, so use memcpy
if (len > 0)
{
ACE_OS::memcpy (hostname, hp->h_name, len - 1);
hostname[len-1]= '\0';
}
errno = ENOSPC;
return -2; // -2 Means that we have a good string
// Using errno looks ok, but ENOSPC could be set on
// other places.
}
ACE_OS::strcpy (hostname, hp->h_name);
return 0;
#endif /* ACE_VXWORKS */
}
}
示例13: test_active_map_manager
static void
test_active_map_manager (size_t table_size,
size_t iterations,
int test_iterators)
{
ACTIVE_MAP_MANAGER map (table_size);
TYPE i;
TYPE j = 0;
ssize_t k;
ACTIVE_MAP_MANAGER::key_type *active_keys;
ACE_NEW (active_keys,
ACTIVE_MAP_MANAGER::key_type[iterations]);
for (i = 0;
i < iterations;
i++)
ACE_ASSERT (map.bind (i, active_keys[i]) != -1);
if (test_iterators)
{
{
i = 0;
ACTIVE_MAP_MANAGER::iterator end = map.end ();
for (ACTIVE_MAP_MANAGER::iterator iter = map.begin ();
iter != end;
++iter)
{
ACTIVE_MAP_MANAGER::ENTRY &entry = *iter;
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%d|%d-%d|%d)"),
i,
entry.ext_id_.slot_index (),
entry.ext_id_.slot_generation (),
entry.int_id_));
++i;
}
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("\n")));
ACE_ASSERT (i == iterations);
}
{
k = iterations - 1;
ACTIVE_MAP_MANAGER::reverse_iterator rend = map.rend ();
for (ACTIVE_MAP_MANAGER::reverse_iterator iter = map.rbegin ();
iter != rend;
++iter)
{
ACTIVE_MAP_MANAGER::ENTRY &entry = *iter;
ACE_UNUSED_ARG (entry);
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%d|%d-%d|%d)"),
k,
entry.ext_id_.slot_index (),
entry.ext_id_.slot_generation (),
entry.int_id_));
k--;
}
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("\n")));
ACE_ASSERT (k == -1);
}
}
for (i = 0; i < iterations; ++i)
{
ACE_ASSERT (map.find (active_keys[i], j) != -1);
ACE_ASSERT (i == j);
}
size_t remaining_entries = iterations;
for (i = 0; i < iterations; ++i)
{
ACE_ASSERT (map.unbind (active_keys[i]) != -1);
--remaining_entries;
ACE_ASSERT (map.current_size () == remaining_entries);
}
delete [] active_keys;
}
示例14: ACE_TRACE
int
ACE_Shared_Memory_Pool::handle_signal (int , siginfo_t *siginfo, ucontext_t *)
{
ACE_TRACE ("ACE_Shared_Memory_Pool::handle_signal");
// ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("signal %S occurred\n"), signum));
// While FreeBSD 5.X has a siginfo_t struct with a si_addr field,
// it does not define SEGV_MAPERR.
#if defined (ACE_HAS_SIGINFO_T) && !defined (ACE_LACKS_SI_ADDR) && \
(defined (SEGV_MAPERR) || defined (SEGV_MEMERR))
ACE_OFF_T offset;
// Make sure that the pointer causing the problem is within the
// range of the backing store.
if (siginfo != 0)
{
// ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) si_signo = %d, si_code = %d, addr = %u\n"), siginfo->si_signo, siginfo->si_code, siginfo->si_addr));
size_t counter;
if (this->in_use (offset, counter) == -1)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("(%P|%t) %p\n"),
ACE_TEXT ("in_use")));
else if (!(siginfo->si_code == SEGV_MAPERR
&& siginfo->si_addr < (((char *) this->base_addr_) + offset)
&& siginfo->si_addr >= ((char *) this->base_addr_)))
ACE_ERROR_RETURN ((LM_ERROR,
"(%P|%t) address %u out of range\n",
siginfo->si_addr),
-1);
}
// The above if case will check to see that the address is in the
// proper range. Therefore there is a segment out there that the
// pointer wants to point into. Find the segment that someone else
// has used and attach to it ([email protected])
size_t counter; // ret value to get shmid from the st table.
if (this->find_seg (siginfo->si_addr, offset, counter) == -1)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("(%P|%t) %p\n"),
ACE_TEXT ("in_use")),
-1);
void *address = (void *) (((char *) this->base_addr_) + offset);
SHM_TABLE *st = reinterpret_cast<SHM_TABLE *> (this->base_addr_);
void *shmem = ACE_OS::shmat (st[counter].shmid_, (char *) address, 0);
if (shmem != address)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT("(%P|%t) %p, shmem = %u, address = %u\n"),
ACE_TEXT("shmat"),
shmem,
address),
-1);
// NOTE: this won't work if we dont have SIGINFO_T or SI_ADDR
#else
ACE_UNUSED_ARG (siginfo);
#endif /* ACE_HAS_SIGINFO_T && !defined (ACE_LACKS_SI_ADDR) */
return 0;
}
示例15: ACE_OS_TRACE
struct tm *
ACE_OS::localtime_r (const time_t *t, struct tm *res)
{
ACE_OS_TRACE ("ACE_OS::localtime_r");
#if defined (ACE_HAS_REENTRANT_FUNCTIONS)
ACE_OSCALL_RETURN (::localtime_r (t, res), struct tm *, 0);
#elif defined (ACE_HAS_TR24731_2005_CRT)
ACE_SECURECRTCALL (localtime_s (res, t), struct tm *, 0, res);
return res;
#elif !defined (ACE_HAS_WINCE)
ACE_OS_GUARD
ACE_UNUSED_ARG (res);
struct tm * res_ptr = 0;
ACE_OSCALL (::localtime (t), struct tm *, 0, res_ptr);
if (res_ptr == 0)
return 0;
else
{
*res = *res_ptr;
return res;
}
#elif defined (ACE_HAS_WINCE)
// This is really stupid, converting FILETIME to timeval back and
// forth. It assumes FILETIME and DWORDLONG are the same structure
// internally.
TIME_ZONE_INFORMATION pTz;
const unsigned short int __mon_yday[2][13] =
{
/* Normal years. */
{ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
/* Leap years. */
{ 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
};
ULARGE_INTEGER _100ns;
::GetTimeZoneInformation (&pTz);
_100ns.QuadPart = (DWORDLONG) *t * 10000 * 1000 + ACE_Time_Value::FILETIME_to_timval_skew;
FILETIME file_time;
file_time.dwLowDateTime = _100ns.LowPart;
file_time.dwHighDateTime = _100ns.HighPart;
FILETIME localtime;
SYSTEMTIME systime;
FileTimeToLocalFileTime (&file_time, &localtime);
FileTimeToSystemTime (&localtime, &systime);
res->tm_hour = systime.wHour;
if(pTz.DaylightBias!=0)
res->tm_isdst = 1;
else
res->tm_isdst = 1;
int iLeap;
iLeap = (res->tm_year % 4 == 0 && (res->tm_year% 100 != 0 || res->tm_year % 400 == 0));
// based on leap select which group to use
res->tm_mday = systime.wDay;
res->tm_min = systime.wMinute;
res->tm_mon = systime.wMonth - 1;
res->tm_sec = systime.wSecond;
res->tm_wday = systime.wDayOfWeek;
res->tm_yday = __mon_yday[iLeap][systime.wMonth] + systime.wDay;
res->tm_year = systime.wYear;// this the correct year but bias the value to start at the 1900
res->tm_year = res->tm_year - 1900;
return res;
#else
// @@ Same as ACE_OS::localtime (), you need to implement it
// yourself.
ACE_UNUSED_ARG (t);
ACE_UNUSED_ARG (res);
ACE_NOTSUP_RETURN (0);
#endif /* ACE_HAS_REENTRANT_FUNCTIONS */
}