本网站可以出售:只需60000元直接拥有。QQ:939804642
您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ ACE_Time_Value函数代码示例

51自学网 2021-06-01 19:32:20
  C++
这篇教程C++ ACE_Time_Value函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中ACE_Time_Value函数的典型用法代码示例。如果您正苦于以下问题:C++ ACE_Time_Value函数的具体用法?C++ ACE_Time_Value怎么用?C++ ACE_Time_Value使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了ACE_Time_Value函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ACE_TEXT

intEcho_Handler::dispatch_echo_checks (int first_call){  // Set ones , if this is the first call (not from handle_timeout)  if (first_call)    {      for (size_t j = 0; j < this->number_remotes_; ++j)        {          this->success_status_[j] = 1;        }      this->current_attempt_ = this->max_attempts_num_;    }  // Send echo-checks.  for (size_t i = 0; i < this->number_remotes_; ++i)    {      if (this->success_status_[i] != 0)        {          if (this->ping_socket ().send_echo_check (                this->remote_addrs_[i],                this->connect_to_remote_) == -1)            ACE_ERROR              ((LM_ERROR,                ACE_TEXT ("(%P|%t) Echo_Handler::dispatch_echo_checks - ")                ACE_TEXT ("failed for this->remote_addrs_[%d]./n"),                i));        }    }  int rval_sched = -1;  if ((rval_sched =         this->reactor ()->schedule_timer (this,                                           0,                                           ACE_Time_Value (1),                                           this->reply_wait_)) == -1)    ACE_ERROR_RETURN ((LM_ERROR,                       ACE_TEXT ("(%P|%t) Echo_Handler::dispatch_echo_checks:")                       ACE_TEXT (" %p/n"),                       ACE_TEXT ("schedule_timer")),                      -1);  return 0;}
开发者ID:PGSeungminLee,项目名称:CGSF,代码行数:42,


示例2: ACE_TMAIN

intACE_TMAIN (int argc, ACE_TCHAR* argv[]){  try  {    if (argc < 2) throw args ();    ACE_INET_Addr addr (argv[1]);    //FUZZ: disable check_for_lack_ACE_OS    // Turn on message loss and reordering simulation.    //    ACE_RMCast::Socket socket (addr, false, true);    //FUZZ: enable check_for_lack_ACE_OS    Message msg;    msg.sn = 0;    for (unsigned short i = 0; i < payload_size; i++)    {      msg.payload[i] = i;    }    for (; msg.sn < message_count; msg.sn++)    {      socket.send (&msg, sizeof (msg));    }    // Keep running in case retransmissions are needed.    //    ACE_OS::sleep (ACE_Time_Value (60, 0));    return 0;  }  catch (args const&)  {    ACE_ERROR ((LM_ERROR,                "usage: %s <IPv4 multicast address>:<port>/n", argv[0]));  }  return 1;}
开发者ID:azraelly,项目名称:knetwork,代码行数:42,


示例3: wait

intDllOrb::fini (void){  try  {    mv_poaManager_->deactivate (1, 1);    mv_poaManager_ = PortableServer::POAManager::_nil ();    // attempt to protect against sporadic BAD_INV_ORDER exceptions    ACE_OS::sleep (ACE_Time_Value (0, 500));      mv_rootPOA_->destroy (1, 1);      mv_rootPOA_ = PortableServer::POA::_nil ();    mv_orb_->shutdown (1);    ACE_DEBUG ((LM_ERROR, ACE_TEXT ("wait() .../n")));    // wait for our threads to finish    wait();    ACE_DEBUG ((LM_ERROR, ACE_TEXT ("wait() done/n")));    ACE_auto_ptr_reset (ma_barrier_, static_cast<ACE_Thread_Barrier *> (0));  }  catch (...)  {    ACE_DEBUG ((LM_ERROR, ACE_TEXT ("ERROR: exception/n")));    return -1;  }  try  {    mv_orb_->destroy ();    mv_orb_ = CORBA::ORB::_nil ();  }  catch (const CORBA::Exception& ex)  {    ex._tao_print_exception ("Exception caught:");    return -1;  }  return 0;}
开发者ID:CCJY,项目名称:ATCD,代码行数:42,


示例4: av

  void  Connection::write(Message& message)  {    ACE_Time_Value av(ACE_OS::gettimeofday() + ACE_Time_Value(1));    if (writeMutex.acquire(av) == -1)      throw Miro::CException(errno, "Error writing can device.");    // Roland: Is this sleep necessary for Sparrow2003 can ???    ACE_Time_Value time = ACE_OS::gettimeofday();    ACE_Time_Value delta = time - lastWrite;    if (delta < canTimeOut) {      // is this sleep necessary ???      // well, yes      ACE_OS::sleep(canTimeOut - delta); // this is at least 10usec thanks to linux      time = ACE_OS::gettimeofday();    }    // will definitely choke if base is off    int rc;    if (parameters_.module == "pcan") {       pcanmsg * msgp;       message.canMessage((int **) &msgp);       msgp->msg.msgtype = MSGTYPE_EXTENDED;       for(int i = 0; i < msgp->msg.len; i++)          std::cout << msgp->msg.data[i];       rc = ioctl(ioBuffer.get_handle(), PCAN_WRITE_MSG, msgp);    }    else {       canmsg * msg;       message.canMessage((int **) &msg);       rc = ioBuffer.send_n(msg, sizeof(canmsg));    }    lastWrite = time;    writeMutex.release();    if (rc == -1)      throw Miro::CException(errno, "Error writing can device.");  }
开发者ID:BackupTheBerlios,项目名称:miro-middleware-svn,代码行数:42,


示例5: handle_timeout

  virtual int handle_timeout (const ACE_Time_Value &,                              const void *arg)  {    ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Test_Handler::handle_timeout/n")));    ++this->nr_expirations_;    void *nc_arg = const_cast<void *> (arg);    Thread_Timer_Queue *timer_queue =      reinterpret_cast<Thread_Timer_Queue *> (nc_arg);    ACE_Time_Value timeout = ACE_OS::gettimeofday () + ACE_Time_Value (1, 0);    ACE_DEBUG ((LM_DEBUG,                ACE_TEXT ("(%t) scheduling new timer 1 sec from now/n")));    if (timer_queue->schedule (this, timer_queue, timeout) == -1)      ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p/n"),                  ACE_TEXT ("schedule failed")));    return 0;  }
开发者ID:INMarkus,项目名称:ATCD,代码行数:20,


示例6: time_of_last_send

int AC_Output_Handler::svc () {  ACE_Message_Block *chunk[ACE_IOV_MAX];  size_t message_index = 0;  ACE_Time_Value time_of_last_send (ACE_OS::gettimeofday ());  ACE_Time_Value timeout;  ACE_Sig_Action no_sigpipe ((ACE_SignalHandler) SIG_IGN);  ACE_Sig_Action original_action;  no_sigpipe.register_action (SIGPIPE, &original_action);  for (;;) {    if (message_index == 0) {      timeout = ACE_OS::gettimeofday ();      timeout += FLUSH_TIMEOUT;    }    ACE_Message_Block *mblk = 0;    if (getq (mblk, &timeout) == -1) {      if (errno == ESHUTDOWN) {        if (connector_->reconnect () == -1) break;        continue;      } else if (errno != EWOULDBLOCK) break;      else if (message_index == 0) continue;    } else {      if (mblk->size () == 0          && mblk->msg_type () == ACE_Message_Block::MB_STOP)        { mblk->release (); break; }      chunk[message_index] = mblk;      ++message_index;    }    if (message_index >= ACE_IOV_MAX ||        (ACE_OS::gettimeofday () - time_of_last_send         >= ACE_Time_Value(FLUSH_TIMEOUT))) {      if (this->send (chunk, message_index) == -1) break;      time_of_last_send = ACE_OS::gettimeofday ();    }  }  if (message_index > 0)    this->send (chunk, message_index);  no_sigpipe.restore_action (SIGPIPE, original_action);  return 0;}
开发者ID:binghuo365,项目名称:BaseLab,代码行数:41,


示例7: ACE_DEBUG

 void Receiver_exec_i::ccm_activate (void) {   ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::ccm_activate /n "));   /// No need to implement anything   /// Start the timer .    if (this->reactor ()->schedule_timer(                this->hello_generator_,  // The callback object                0,                       // No arguments for this callback                ACE_Time_Value (1, 0),   // Initial delay                this->interval_) == -1)  // Time interval      {        ACE_ERROR ((LM_ERROR, "Receiver_exec_i::ccm_activate - "                              "Error scheduling timer/n"));      }    else      {        ACE_DEBUG ((LM_DEBUG, "Receiver_exec_i::ccm_activate - "                              "Hello generator is running/n"));      }  }
开发者ID:INMarkus,项目名称:ATCD,代码行数:21,


示例8: server_

TAO_BEGIN_VERSIONED_NAMESPACE_DECL// Constructor.TAO_Time_Service_Clerk::TAO_Time_Service_Clerk (int timer_value,                                                int timer_value_usecs,                                                const IORS& servers)  : server_ (servers),    helper_ (this){  // Schedule the helper to be invoked by the reactor  // periodically.  if (TAO_ORB_Core_instance ()->reactor ()->schedule_timer      (&helper_,       0,       ACE_Time_Value::zero,       ACE_Time_Value(timer_value,timer_value_usecs)) == -1)    ORBSVCS_ERROR ((LM_ERROR,                "%p/n",                "schedule_timer ()"));}
开发者ID:binary42,项目名称:OCI,代码行数:21,


示例9: reuseAddr_test

int reuseAddr_test (void){# if defined ACE_WIN32 || !defined ACE_LACKS_IOCTL  ACE_SOCK_Dgram_Bcast sock1;  if (sock1.open(ACE_INET_Addr(UDP_PORT),PF_INET,0,1) != 0)  {    ACE_ERROR ((LM_ERROR, ACE_TEXT ("Could not open socket for broadcast on port %d/n"), UDP_PORT ));    ++result;  }  else  {    // Keep the socket open for some time    ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Opened socket on port %d and keep it open for %d sec/n"), UDP_PORT,  SEC_TO_KEEP_SOCKET_OPEN));    ACE_OS::sleep(ACE_Time_Value(SEC_TO_KEEP_SOCKET_OPEN,0));    sock1.close();  }# endif  return result;}
开发者ID:DOCGroup,项目名称:ACE_TAO,代码行数:21,


示例10: main

int main (int, char* []){    ACE_Reactor reactor;    Time_Handler* th = new Time_Handler;    int timer_id[NUMBER_TIMERS];    for (int i = 0; i < NUMBER_TIMERS; i++)	{        timer_id[i] = reactor.schedule_timer(th,                                              (const void *)i, // argument sent to handle_timeout()                                              ACE_Time_Value(2 * i + 1)); //set timer to go off with delay	}	    //Cancel the fifth timer before it goes off    reactor.cancel_timer(timer_id[5]);//Timer ID of timer to be removed    while (!done)	{        reactor.handle_events();	}    return 0;}
开发者ID:air2013,项目名称:huapuyu,代码行数:21,


示例11: svc

 int svc( )  {   if ( m_sleep == ACE_Time_Value( 0 ) ) {     printf( "###### TIMEBOMB Disabled. ######/n" );     fflush( stdout );     return 0;   }   ACE_Time_Value start = ACE_OS::gettimeofday();   ACE_Time_Value now = ACE_OS::gettimeofday();   do {     ACE_OS::sleep( 1 );     now = ACE_OS::gettimeofday();   } while( now - start < m_sleep );   printf( "####### ERROR: TIMEBOMB WENT OFF, TEST TIMED OUT ########/n" );   fflush( stdout );      callClientCleanup();      exit( -1 );   return 0; }
开发者ID:leloulight,项目名称:gemfirexd-oss,代码行数:21,


示例12: OUR_DEBUG

int CLogManager::PutLog(_LogBlockInfo* pLogBlockInfo){    ACE_Message_Block* mb = pLogBlockInfo->GetQueueMessage();    //如果正在重新加载    if(m_blIsNeedReset == true)    {        //回收日志块        m_objLogBlockPool.ReturnBlockInfo(pLogBlockInfo);        return 0;    }    if(mb)    {        int msgcount = (int)msg_queue()->message_count();        if (msgcount >= m_nQueueMax)        {            OUR_DEBUG((LM_INFO,"[CLogManager::PutLog] CLogManager queue is full!/n"));            //回收日志块            m_objLogBlockPool.ReturnBlockInfo(pLogBlockInfo);            return -1;        }        ACE_Time_Value xtime = ACE_OS::gettimeofday()+ACE_Time_Value(0, MAX_MSG_PUTTIMEOUT);        if(this->putq(mb, &xtime) == -1)        {            OUR_DEBUG((LM_ERROR,"[CLogManager::PutLog] CLogManager putq error(%s)!/n", pLogBlockInfo->m_pBlock));            //回收日志块            m_objLogBlockPool.ReturnBlockInfo(pLogBlockInfo);            return -1;        }        return 0;    }    OUR_DEBUG((LM_ERROR,"[CLogManager::PutLog] CLogManager new ACE_Message_Block error!/n"));    return -1;}
开发者ID:freeeyes,项目名称:PSS,代码行数:40,


示例13: ACE_TEST_ASSERT

intTime_Handler::handle_timeout (const ACE_Time_Value &tv,                              const void *arg){  long current_count = static_cast<long> (reinterpret_cast<size_t> (arg));  if (current_count >= 0)    ACE_TEST_ASSERT (current_count == the_count);  ACE_DEBUG ((LM_DEBUG,              ACE_TEXT ("[%x] Timer id %d with count #%d|%d timed out at %d!/n"),              this,              this->timer_id (),              the_count,              current_count,              tv.sec ()));  if (current_count == long (ACE_MAX_TIMERS - 1))    done = 1;  else if (the_count == long (ACE_MAX_TIMERS - 1))    {      done = 1;      return -1;    }  else if (current_count == -1)    {#if defined (ACE_HAS_CPP11)      int result = ACE_Reactor::instance ()->reset_timer_interval (this->timer_id (),                                                                   std::chrono::seconds {the_count + 1});#else      int result = ACE_Reactor::instance ()->reset_timer_interval (this->timer_id (),                                                                   ACE_Time_Value (the_count + 1));#endif      if (result == -1)        ACE_ERROR ((LM_ERROR,                    ACE_TEXT ("Error resetting timer interval/n")));    }  the_count += (1 + odd);  return 0;}
开发者ID:INMarkus,项目名称:ATCD,代码行数:39,


示例14: test_registering_all_handlers

static voidtest_registering_all_handlers (void){  ACE_Trace t (ACE_TEXT ("test_registering_all_handler"),               __LINE__,               ACE_TEXT_CHAR_TO_TCHAR (__FILE__));  Time_Handler rt[ACE_MAX_TIMERS];  long t_id[ACE_MAX_TIMERS];  for (size_t i = 0; i < ACE_MAX_TIMERS; i++)    {      t_id[i] =        ACE_Reactor::instance ()->schedule_timer (&rt[i],                                                  (const void *) i,                                                  ACE_Time_Value (2 * i + 1));      ACE_TEST_ASSERT (t_id[i] != -1);      rt[i].timer_id (t_id[i]);    }  while (!done)    ACE_Reactor::instance ()->handle_events ();}
开发者ID:huangyt,项目名称:foundations.github.com,代码行数:22,


示例15: ACE_DEBUG

CORBA::LongSimple_Server_i::test_method (CORBA::Boolean do_callback){  if (do_callback)    {      // Scheduling ourselves for doing the callbacks      if (TAO_debug_level > 0)      ACE_DEBUG ((LM_DEBUG,                  ACE_TEXT ("Scheduling for callback/n")));      if (this->orb_->orb_core ()->reactor ()->schedule_timer (this,                                                               0,                                                               ACE_Time_Value (1)) == -1)        {          ACE_ERROR ((LM_ERROR,                      "(%P|%t) Can't schedule timers, aborting ../n"));          ACE_OS::abort ();        }    }  return 0;}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:23,


示例16: ACE_UNUSED_ARG

/* Closing the thread pool can be a tricky exercise.  I've decided to   take an easy approach and simply enqueue a secret message for each   thread we have active.  */intThread_Pool::close (u_long flags){    ACE_UNUSED_ARG(flags);    /* Find out how many threads are currently active */    int counter = active_threads_.value ();    /* For each one of the active threads, enqueue a "null" event      handler.  Below, we'll teach our svc() method that "null" means      "shutdown".  */    while (counter--)        this->enqueue (0);    /* As each svc() method exits, it will decrement the active thread      counter.  We just wait here for it to reach zero.  Since we don't      know how long it will take, we sleep for a quarter of a second      between tries.  */    while (active_threads_.value ())        ACE_OS::sleep (ACE_Time_Value (0, 250000));    return(0);}
开发者ID:huganle,项目名称:code,代码行数:26,


示例17: ACE_DEBUG

intPurger_Thread::svc (void){  ACE_DEBUG ((LM_DEBUG,    ACE_TEXT("(%t) Purger_Thread::svc commencing/n")));  disable_signal (SIGPIPE, SIGPIPE);  for (; !this->reactor_.reactor_event_loop_done ();)    {      // Get a connection from the cache.      Sender *sender =        this->connection_cache_.acquire_connection ();      // If no connection is available in the cache, sleep for a while.      if (sender == 0)        ACE_OS::sleep (ACE_Time_Value (0, 10 * 1000));      else        {          // The reference count on the sender was increased by the          // cache before it was returned to us.          ACE_Event_Handler_var safe_sender (sender);          // Actively close the connection.          ACE_DEBUG ((LM_DEBUG,                      ACE_TEXT ("(%t) Purger thread calling Sender::close() ")                      ACE_TEXT ("for handle %d/n"),                      sender->handle_));          sender->close ();        }    }  ACE_DEBUG ((LM_DEBUG,    ACE_TEXT("(%t) Purger_Thread::svc terminating/n")));  return 0;}
开发者ID:helixum,项目名称:wow-cata,代码行数:37,


示例18: my_args

boolMyMain::init_server (const ACE_TCHAR* args){  std::string my_args (ACE_TEXT_ALWAYS_CHAR(args));  // main thread and extra thread for backdoor operations  int thread_pool = 2;  ACE_auto_ptr_reset (server_task_, new Server_Task (my_args));  ACE_ASSERT (server_task_.get() != 0);  server_task_->activate (THR_NEW_LWP | THR_JOINABLE |THR_INHERIT_SCHED                          , thread_pool);  int duration = 4; //wait 3 seconds for initialization  ACE_Time_Value current = ACE_High_Res_Timer::gettimeofday_hr ();  ACE_Time_Value timeout = current + ACE_Time_Value(duration);  while (current < timeout) {    if (server_task_->ready()) {      break;    }    ACE_Time_Value sleep_time;    sleep_time.msec (10);    ACE_OS::sleep (sleep_time);    current += sleep_time;  }  if (!server_task_->ready()) {    server_task_->force_shutdown ();    server_task_->wait ();    ACE_auto_ptr_reset (server_task_, (Server_Task*)0);    return false;  }  return true;}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:36,


示例19: ACE_DEBUG

int KSG_Task_Queue_Pool::wait_for_queue(const std::string &key,long time_out){	queue_cond_map_type::const_iterator i = _queue_cond.find(key);	if(i == _queue_cond.end())	{		ACE_DEBUG((LM_ERROR,"没有对应的队列[%s]",key.c_str()));		return -1;	}	Queue_List_Cond *cond = i->second;	ACE_DEBUG((LM_DEBUG,"等待队列组[%s]...",key.c_str()));	int ret;	if(time_out > 0)	{		ACE_Time_Value tv = ACE_Time_Value(time_out/1000,time_out%1000);		tv += ACE_OS::gettimeofday();		ret = cond->wait(&tv);		// maybe timeout 		if( ret == -1 && ACE_OS::last_error() == ETIME )			ret = 1;	}	else		ret = cond->wait(NULL);	return ret;}
开发者ID:nykma,项目名称:ykt4sungard,代码行数:24,


示例20: test_canceling_odd_timers

static voidtest_canceling_odd_timers (void){  ACE_Trace t (ACE_TEXT ("test_canceling_odd_timers"),               __LINE__,               ACE_TEXT_CHAR_TO_TCHAR (__FILE__));  Time_Handler rt[ACE_MAX_TIMERS];  long t_id[ACE_MAX_TIMERS];  done = 0;  the_count = 1;  odd = 1;  for (size_t i = 0; i < ACE_MAX_TIMERS; i++)    {      t_id[i] = ACE_Reactor::instance ()->schedule_timer (&rt[i],                                                          (const void *) i,                                                          ACE_Time_Value (2 * i + 1));      ACE_TEST_ASSERT (t_id[i] != -1);      rt[i].timer_id (t_id[i]);    }  for (size_t j = 0; (u_long) j < ACE_MAX_TIMERS; j++)    // Cancel handlers with odd numbered timer ids.    if (ACE_ODD (rt[j].timer_id ()))      {        int result =          ACE_Reactor::instance ()->cancel_timer (rt[j].timer_id ());        if (result == -1)          ACE_ERROR ((LM_ERROR,                      ACE_TEXT ("Error cancelling timer/n")));      }  while (!done)    ACE_Reactor::instance ()->handle_events ();}
开发者ID:huangyt,项目名称:foundations.github.com,代码行数:36,


示例21: test_canceling_odd_timers

static voidtest_canceling_odd_timers (void){  ACE_Trace t (ACE_TEXT ("test_canceling_odd_timers"),               __LINE__,               ACE_TEXT_CHAR_TO_TCHAR (__FILE__));  Time_Handler rt[ACE_MAX_TIMERS];  long t_id[ACE_MAX_TIMERS];  size_t which[ACE_MAX_TIMERS];  done = 0;  counter = 1;  odd = 1;  size_t i = 0;  long secs = 0;  for ( ; i < ACE_MAX_TIMERS; i++, secs++)    {      which[i] = i;      t_id[i] = ACE_Proactor::instance ()->schedule_timer        (rt[i], &which[i], ACE_Time_Value (2 * secs + 1));      if (t_id[i] == -1)        ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p/n"), ACE_TEXT ("schedule_timer")));      rt[i].timer_id (t_id[i]);    }  for (i = 0; i < ACE_MAX_TIMERS; i++)    // Cancel handlers with odd numbered timer ids.    if (ACE_ODD (rt[i].timer_id ()))      {        if (ACE_Proactor::instance ()->cancel_timer (rt[i].timer_id ()) == -1)          ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p/n"), ACE_TEXT ("cancel_timer")));      }  while (!done)    ACE_Proactor::instance ()->handle_events ();}
开发者ID:asdlei00,项目名称:ACE,代码行数:36,


示例22: ACE_Time_Value

void CUnit_TimerManager::Test_TimerManager(void){    bool blRet = false;    ActiveTimer objActiveTimer;    objActiveTimer.activate();    ACE_Time_Value tvNow = ACE_OS::gettimeofday();    long lTimerID = objActiveTimer.schedule(m_pTimeTask, NULL, tvNow + ACE_Time_Value(0, 1000));    if (-1 == lTimerID)    {        CPPUNIT_ASSERT_MESSAGE("[Test_TimerManager]schedule is fail.", true == blRet);    }    ACE_Time_Value tvSleep(0, 2000);    ACE_OS::sleep(tvSleep);    objActiveTimer.deactivate();    objActiveTimer.close();    ACE_Time_Value tvSleepClose(0, 1000);    ACE_OS::sleep(tvSleepClose);    OUR_DEBUG((LM_INFO, "[CUnit_TimerManager]objActiveTimer is close./n"));}
开发者ID:freeeyes,项目名称:PSS,代码行数:24,


示例23: run_main

//.........这里部分代码省略.........      ACE_DEBUG ((LM_DEBUG,                  ACE_TEXT ("(%t) task_count %d future_count %d ")                  ACE_TEXT ("capsule_count %d method_request_count %d/n"),                  task_count.value (),                  future_count.value (),                  capsule_count.value (),                  method_request_count.value ()));    }  // Close things down.  andres->end ();  peter->end ();  helmut->end ();  matias->end ();  ACE_Thread_Manager::instance ()->wait ();  ACE_DEBUG ((LM_DEBUG,              ACE_TEXT ("(%t) task_count %d future_count %d ")              ACE_TEXT ("capsule_count %d method_request_count %d/n"),              task_count.value (),              future_count.value (),              capsule_count.value (),              method_request_count.value ()));  {    // Check if set then get works, older versions of <ACE_Future>    // will lock forever (or until the timer expires), will use a    // small timer value to avoid blocking the process.    ACE_Future<int> f1;    f1.set (100);    // Note you need to use absolute time, not relative time.    ACE_Time_Value timeout (ACE_OS::gettimeofday () + ACE_Time_Value (10));    int value = 0;    if (f1.get (value, &timeout) == 0        && value == 100)      ACE_DEBUG ((LM_DEBUG,                  ACE_TEXT ("Ace_Future<T>::Set followed by Ace_Future<T>::Get works./n")));    else      ACE_DEBUG ((LM_DEBUG,                  ACE_TEXT ("ACE_Future<T>::Set followed by Ace_Future<T>::Get does ")                  ACE_TEXT ("not work, broken Ace_Future<> implementation./n")));  }  {    ACE_DEBUG ((LM_DEBUG,                ACE_TEXT ("Checking if Ace_Future<T>::operator= is implemented ")                ACE_TEXT ("incorrectly this might crash the program./n")));    ACE_Future<int> f1;    {      // To ensure that a rep object is created.      ACE_Future<int> f2 (f1);    }    // Now it is one ACE_Future<int> referencing the rep instance    ACE_DEBUG ((LM_DEBUG,                ACE_TEXT ("0./n")));    //Check that self assignment works.    f1 = f1;    // Is there any repesentation left, and if so what is the ref    // count older ACE_Future<> implementations have deleted the rep    // instance at this moment
开发者ID:esohns,项目名称:ATCD,代码行数:67,


示例24:

voidTAO_DTP_POA_Strategy::set_dtp_config (TAO_DTP_Definition &tp_config){  if (tp_config.min_threads_ <= 0)    {      this->dtp_task_.set_min_pool_threads (1);      this->dtp_task_.set_thread_idle_time (ACE_Time_Value (0,0));    }  else    {      this->dtp_task_.set_min_pool_threads (tp_config.min_threads_);      this->dtp_task_.set_thread_idle_time (tp_config.timeout_);    }  // initial_pool_threads_  if ((tp_config.init_threads_ <= 0) ||      (tp_config.init_threads_ < tp_config.min_threads_))    {     this->dtp_task_.set_init_pool_threads (this->dtp_task_.get_min_pool_threads());    }  else    {      this->dtp_task_.set_init_pool_threads (tp_config.init_threads_);    }  // max_pool_threads_  if (tp_config.max_threads_ <= 0)    {      // Set to 0 so that max is unbounded.      this->dtp_task_.set_max_pool_threads(0);    }  else    {      if (tp_config.max_threads_ < tp_config.init_threads_)        {          this->dtp_task_.set_max_pool_threads(            this->dtp_task_.get_init_pool_threads ());        }      else        {          this->dtp_task_.set_max_pool_threads (tp_config.max_threads_);        }    }  // thread_stack_size_  if (tp_config.stack_size_ <= 0)    {      this->dtp_task_.set_thread_stack_size (ACE_DEFAULT_THREAD_STACKSIZE);    }  else    {      this->dtp_task_.set_thread_stack_size (tp_config.stack_size_);    }  // max_request_queue_depth_  if (tp_config.queue_depth_ < 0)    {      this->dtp_task_.set_max_request_queue_depth (0);    }  else    {      this->dtp_task_.set_max_request_queue_depth (tp_config.queue_depth_);    }  if (TAO_debug_level > 4)    {      TAOLIB_DEBUG ((LM_DEBUG,        ACE_TEXT ("TAO (%P|%t) - DTP_POA_Strategy: ")        ACE_TEXT ("Initialized with:/n")        ACE_TEXT ("TAO (%P|%t) - DTP_POA_Strategy initial_pool_threads_=")        ACE_TEXT ("[%d]/n")        ACE_TEXT ("TAO (%P|%t) - DTP_POA_Strategy min_pool_threads_=[%d]/n")        ACE_TEXT ("TAO (%P|%t) - DTP_POA_Strategy max_pool_threads_=[%d]/n")        ACE_TEXT ("TAO (%P|%t) - DTP_POA_Strategy max_request_queue_depth_=")        ACE_TEXT ("[%d]/n")        ACE_TEXT ("TAO (%P|%t) - DTP_POA_Strategy thread_stack_size_=[%d]/n")        ACE_TEXT ("TAO (%P|%t) - DTP_POA_Strategy thread_idle_time_=[%d]/n"),        this->dtp_task_.get_init_pool_threads(),        this->dtp_task_.get_min_pool_threads(),        this->dtp_task_.get_max_pool_threads(),        this->dtp_task_.get_max_request_queue_depth(),        this->dtp_task_.get_thread_stack_size(),        this->dtp_task_.get_thread_idle_time()));    }}
开发者ID:esohns,项目名称:ATCD,代码行数:85,


示例25: run_main

intrun_main (int argc, ACE_TCHAR *argv[]){  ACE_START_TEST (ACE_TEXT ("XtMotifReactor_Test"));  XtAppContext app_context;  Widget topLevel, goodbye, PressMe, lbl, digits_rc;  Widget children[5];#if defined (HummingBird_X)  HCLXmInit ();#endif /* HummingBird_X */  topLevel = XtVaAppInitialize (&app_context,                                "XTReactor_Test",                                0,                                0,                                &argc,                                argv,                                0,                                static_cast<void *>(0));  digits_rc = create_box(topLevel, "digits_rc");  //"Stop Test" button.  goodbye = XtCreateWidget ( (char *) "goodbye",                             BUTTON_WIDGET,                             digits_rc,                             0,                             0);  set_label(goodbye, "Stop Test");  //"Press Me" button  PressMe = XtCreateWidget ((char *) "PressMe",                            BUTTON_WIDGET,                            digits_rc,                            0,                            0);  //Display for event counter  lbl = XtCreateWidget ((char *) "label_for_event_one",                        LABEL_WIDGET,                        digits_rc,                        0,                        0);  set_label(lbl, "label_for_all_events");  int ac = 0;  children[ac++] = goodbye;  children[ac++] = PressMe;  children[ac++] = lbl;  XtManageChildren (children, ac);  XtManageChild (digits_rc);  //Register callback for "Stop Test" button  XtAddCallback (goodbye, PRESS_ME_CALLBACK, Quit, 0);  //Register callback for "Press Me" button  XtAddCallback (PressMe,                 PRESS_ME_CALLBACK,                 inc_count,                 (XtPointer) lbl);  // Register callback for X Timer  (void) XtAppAddTimeOut (app_context,                          1000,                          inc_tmo,                          (XtPointer) lbl);  XtRealizeWidget (topLevel);  // It will perform X Main Loop  ACE_XtReactor reactor (app_context);  ACE_Reactor r (&reactor);  //Event Handler for ACE Timer.  EV_handler evh;  ACE_Acceptor <Connection_Handler, ACE_SOCK_ACCEPTOR> acceptor;  if (acceptor.open (ACE_INET_Addr ((u_short) SERV_TCP_PORT),                     &r) == -1)    ACE_ERROR_RETURN ((LM_ERROR,                       "%p/n",                       "open"),                      -1);  if (reactor.schedule_timer (&evh,                              (const void *) lbl,                              ACE_Time_Value (2),                              ACE_Time_Value (2))==-1)    ACE_ERROR_RETURN ((LM_ERROR,                       " (%P|%t) can't register with reactor/n"),                      -1);  ACE_Thread_Manager::instance ()->spawn ((ACE_THR_FUNC) client,                                          0,                                          THR_NEW_LWP | THR_DETACHED);  XtAppMainLoop (XtWidgetToApplicationContext (topLevel));//.........这里部分代码省略.........
开发者ID:asdlei00,项目名称:ACE,代码行数:101,


示例26: ACE_TMAIN

intACE_TMAIN(int argc, ACE_TCHAR *argv[]){  try    {      CORBA::ORB_var orb =        CORBA::ORB_init (argc, argv);      if (parse_args (argc, argv) != 0)        return 1;      CORBA::Object_var object =        orb->string_to_object (ior);      A::AMI_Test_var server =  A::AMI_Test::_narrow (object.in ());      if (CORBA::is_nil (server.in ()))        {          ACE_ERROR_RETURN ((LM_ERROR,                             "Object reference <%s> is nil./n",                             ior),                            1);        }      // Activate POA to handle the call back.      CORBA::Object_var poa_object =        orb->resolve_initial_references("RootPOA");      if (CORBA::is_nil (poa_object.in ()))        ACE_ERROR_RETURN ((LM_ERROR,                           " (%P|%t) Unable to initialize the POA./n"),                          1);      PortableServer::POA_var root_poa =        PortableServer::POA::_narrow (poa_object.in ());      PortableServer::POAManager_var poa_manager =        root_poa->the_POAManager ();      poa_manager->activate ();      // Let the client perform the test in a separate thread      Handler* handler = 0;      ACE_NEW_RETURN (handler,                      Handler,                      1);      PortableServer::ServantBase_var owner_transfer(handler);      PortableServer::ObjectId_var id =        root_poa->activate_object (handler);      CORBA::Object_var object2 = root_poa->id_to_reference (id.in ());      A::AMI_AMI_TestHandler_var hello = A::AMI_AMI_TestHandler::_narrow (object2.in ());      object2 = CORBA::Object::_nil ();      server->shutdown (); // oneway, so returns here immediately but server waits 5 sec      Client client (server.in (), niterations, hello.in ());      if (client.activate (THR_NEW_LWP | THR_JOINABLE,                           nthreads) != 0)        ACE_ERROR_RETURN ((LM_ERROR,                           "Cannot activate client threads/n"),                          1);      // Main thread collects replies. It needs to collect      // <nthreads*niterations> replies.      number_of_replies = nthreads *niterations;      if (debug)        {          ACE_DEBUG ((LM_DEBUG,                      "(%P|%t) : Entering perform_work loop to receive <%d> replies/n",                      number_of_replies));        }      // ORB loop.      ACE_Time_Value tv (1,0);      orb->run (tv);      if (debug)        {          ACE_DEBUG ((LM_DEBUG,                      "(%P|%t) : Exited perform_work loop Received <%d> replies/n",                      (nthreads*niterations) - number_of_replies));        }      ACE_DEBUG ((LM_DEBUG, "threads finished/n"));      client.wait ();      tv = ACE_Time_Value (1,0);      orb->run (tv);      root_poa->deactivate_object (id.in ());      root_poa->destroy (1,  // ethernalize objects                         0);  // wait for completion      hello = A::AMI_AMI_TestHandler::_nil ();      root_poa = PortableServer::POA::_nil ();//.........这里部分代码省略.........
开发者ID:OspreyHub,项目名称:ATCD,代码行数:101,


示例27: db

int RASocket::subnegotiate(){    char buf[1024];    ACE_Data_Block db(sizeof (buf),        ACE_Message_Block::MB_DATA,        buf,        0,        0,        ACE_Message_Block::DONT_DELETE,        0);    ACE_Message_Block message_block(&db,        ACE_Message_Block::DONT_DELETE,        0);    const size_t recv_size = message_block.space();    // Wait a maximum of 1000ms for negotiation packet - not all telnet clients may send it    ACE_Time_Value waitTime = ACE_Time_Value(1);    const ssize_t n = peer().recv(message_block.wr_ptr(),        recv_size, &waitTime);    if (n <= 0)        return int(n);    if (n >= 1024)    {        sLog->outRemote("RASocket::subnegotiate: allocated buffer 1024 bytes was too small for negotiation packet, size: %u", n);        return -1;    }    buf[n] = '/0';    #ifdef _DEBUG    for (uint8 i = 0; i < n; )    {        uint8 iac = buf[i];        if (iac == 0xFF)   // "Interpret as Command" (IAC)        {            uint8 command = buf[++i];            std::stringstream ss;            switch (command)            {                case 0xFB:        // WILL                    ss << "WILL ";                    break;                case 0xFC:        // WON'T                    ss << "WON'T ";                    break;                case 0xFD:        // DO                    ss << "DO ";                    break;                case 0xFE:        // DON'T                    ss << "DON'T ";                    break;                default:                    return -1;      // not allowed            }            uint8 param = buf[++i];            ss << uint32(param);            sLog->outRemote(ss.str().c_str());        }        ++i;    }    #endif    //! Just send back end of subnegotiation packet    uint8 const reply[2] = {0xFF, 0xF0};    return peer().send(reply, 2);}
开发者ID:Sar777,项目名称:SkyFireEMU,代码行数:72,


示例28: rsleep

void Writer::rsleep(const int wait){  int lwait = 1 + (ACE_OS::rand() % wait);  ACE_OS::sleep(ACE_Time_Value(0, lwait));}
开发者ID:Fantasticer,项目名称:OpenDDS,代码行数:5,



注:本文中的ACE_Time_Value函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ ACE_UNUSED_ARG函数代码示例
C++ ACE_TRACE函数代码示例
51自学网自学EXCEL、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。
京ICP备13026421号-1