當前位置: 首頁>>代碼示例>>C++>>正文


C++ ACELIB_ERROR_RETURN函數代碼示例

本文整理匯總了C++中ACELIB_ERROR_RETURN函數的典型用法代碼示例。如果您正苦於以下問題:C++ ACELIB_ERROR_RETURN函數的具體用法?C++ ACELIB_ERROR_RETURN怎麽用?C++ ACELIB_ERROR_RETURN使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了ACELIB_ERROR_RETURN函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: ACE_TRACE

int
ACE_Token_Proxy::renew (int requeue_position,
                        ACE_Synch_Options &options)
{
  ACE_TRACE ("ACE_Token_Proxy::renew");
  if (this->token_ == 0)
    {
      errno = ENOENT;
      ACELIB_ERROR_RETURN ((LM_ERROR,
                         ACE_TEXT ("Not open.\n")),
                        -1);
    }

  // Make sure no one calls our token_acquired until we have a chance
  // to sleep first!
  this->waiter_->cond_var_.mutex ().acquire ();

  if (this->token_->renew (this->waiter_, requeue_position) == -1)
    {
      // check for error
      if (errno != EWOULDBLOCK)
        ACELIB_ERROR_RETURN ((LM_ERROR,
                           ACE_TEXT ("%p renew failed\n"), ACE_TEXT ("ACE_Token_Proxy")), -1);

      if (this->debug_)
        ACELIB_DEBUG ((LM_DEBUG,  ACE_TEXT ("(%t) renew blocking for %s, owner is %s\n"),
                    this->name (),
                    token_->owner_id ()));

      // no error, but would block, so block or return
      return this->handle_options (options, waiter_->cond_var_);
    }
  else
    // we have the token
    {
      if (this->debug_)
        ACELIB_DEBUG ((LM_DEBUG,  ACE_TEXT ("(%t) renewed %s\n"),
                    this->name ()));
      waiter_->cond_var_.mutex ().release ();
      return 0;
    }
}
開發者ID:Arkania,項目名稱:ArkCORE-NG,代碼行數:42,代碼來源:Local_Tokens.cpp

示例2: ACELIB_ERROR_RETURN

void*
ACE_Threading_Helper<ACE_Thread_Mutex>::get (void)
{
  void* temp = 0;
  if (ACE_Thread::getspecific (key_, &temp) == -1)
    ACELIB_ERROR_RETURN ((LM_ERROR,
                       ACE_TEXT ("(%P|%t) Service Config failed to get thread key value: %p\n"),
                       ACE_TEXT("")),
                      0);
  return temp;
}
開發者ID:CCJY,項目名稱:ACE,代碼行數:11,代碼來源:Service_Config.cpp

示例3: ACELIB_ERROR_RETURN

int
ACE_RAPI_Session::update_qos (void)
{
  // Update the session QoS Parameters based on the RSVP Event Received.
  if ((rsvp_error = rapi_dispatch ()) != 0)
    ACELIB_ERROR_RETURN ((LM_ERROR,
                       "Error in rapi_dispatch () : %s\n",
                       rapi_errlist[rsvp_error]),
                      -1);
  return 0;
}
開發者ID:AtVirus,項目名稱:SkyFireEMU,代碼行數:11,代碼來源:QoS_Session_Impl.cpp

示例4: while

int
ACE_Proactor_Timer_Handler::svc (void)
{
  ACE_Time_Value absolute_time;
  ACE_Time_Value relative_time;
  int result = 0;

  while (this->shutting_down_ == 0)
    {
      // Check whether the timer queue has any items in it.
      if (this->proactor_.timer_queue ()->is_empty () == 0)
        {
          // Get the earliest absolute time.
          absolute_time = this->proactor_.timer_queue ()->earliest_time ();

          // Get current time from timer queue since we don't know
          // which <gettimeofday> was used.
          ACE_Time_Value cur_time =
            this->proactor_.timer_queue ()->gettimeofday ();

          // Compare absolute time with curent time received from the
          // timer queue.
          if (absolute_time > cur_time)
            relative_time = absolute_time - cur_time;
          else
            relative_time = ACE_Time_Value::zero;

          // Block for relative time.
          result = this->timer_event_.wait (&relative_time, 0);
        }
      else
        // The timer queue has no entries, so wait indefinitely.
        result = this->timer_event_.wait ();

      // Check for timer expiries.
      if (result == -1)
        {
          switch (errno)
            {
            case ETIME:
              // timeout: expire timers
              this->proactor_.timer_queue ()->expire ();
              break;
            default:
              // Error.
              ACELIB_ERROR_RETURN ((LM_ERROR,
                                 ACE_TEXT ("%N:%l:(%P | %t):%p\n"),
                                 ACE_TEXT ("ACE_Proactor_Timer_Handler::svc:wait failed")),
                                -1);
            }
        }
    }
  return 0;
}
開發者ID:GlassFace,項目名稱:sunwell,代碼行數:54,代碼來源:Proactor.cpp

示例5: ACE_TRACE

int
ACE_Service_Config::parse_args_i (int argc, ACE_TCHAR *argv[])
{
  ACE_TRACE ("ACE_Service_Config::parse_args_i");

  // Using PERMUTE_ARGS (default) in order to have all
  // unrecognized options and their value arguments moved
  // to the end of the argument vector. We'll pick them up
  // after processing our options and pass them on to the
  // base class for further parsing.
  //FUZZ: disable check_for_lack_ACE_OS
  ACE_Get_Opt getopt (argc,
                      argv,
                      ACE_TEXT ("bs:p:"),
                      1  ,                       // Start at argv[1].
                      0,                       // Do not report errors
                      ACE_Get_Opt::RETURN_IN_ORDER);
  //FUZZ: enable check_for_lack_ACE_OS

  //FUZZ: disable check_for_lack_ACE_OS
  for (int c; (c = getopt ()) != -1; )
  //FUZZ: enable check_for_lack_ACE_OS
    switch (c)
      {
      case 'p':
        ACE_Service_Config::pid_file_name_ = getopt.opt_arg ();
        break;
      case 'b':
        ACE_Service_Config::be_a_daemon_ = true;
        break;
      case 's':
        {
          // There's no point in dealing with this on NT since it
          // doesn't really support signals very well...
#if !defined (ACE_LACKS_UNIX_SIGNALS)
          ACE_Service_Config::signum_ =
            ACE_OS::atoi (getopt.opt_arg ());

          if (ACE_Reactor::instance ()->register_handler
              (ACE_Service_Config::signum_,
               ACE_Service_Config::signal_handler_) == -1)
            ACELIB_ERROR_RETURN ((LM_ERROR,
                               ACE_TEXT ("cannot obtain signal handler\n")),
                              -1);
#endif /* ACE_LACKS_UNIX_SIGNALS */
          break;
        }
      default:; // unknown arguments are benign

      }

  return 0;
} /* parse_args_i () */
開發者ID:CCJY,項目名稱:ACE,代碼行數:53,代碼來源:Service_Config.cpp

示例6: ACE_TRACE

int
ACE_Remote_Token_Proxy::initiate_connection (void)
{
    ACE_TRACE ("ACE_Remote_Token_Proxy::initiate_connection");
    if (token_ == 0)
    {
        errno = ENOENT;
        ACELIB_ERROR_RETURN ((LM_ERROR,
                              ACE_TEXT ("ACE_Remote_Token_Proxy not open.\n")), -1);
    }

    ACE_SOCK_Stream *peer = ACE_Token_Connections::instance ()->get_connection ();
    return peer == 0 ? 0 : 1;
}
開發者ID:binary42,項目名稱:OCI,代碼行數:14,代碼來源:Remote_Tokens.cpp

示例7: ACELIB_ERROR_RETURN

int
ACE_Proactor_Handle_Timeout_Upcall::proactor (ACE_Proactor &proactor)
{
  if (this->proactor_ == 0)
    {
      this->proactor_ = &proactor;
      return 0;
    }
  else
    ACELIB_ERROR_RETURN ((LM_ERROR,
                       ACE_TEXT ("ACE_Proactor_Handle_Timeout_Upcall is only suppose")
                       ACE_TEXT (" to be used with ONE (and only one) Proactor\n")),
                      -1);
}
開發者ID:GlassFace,項目名稱:sunwell,代碼行數:14,代碼來源:Proactor.cpp

示例8: rapi_release

// Close the RAPI QoS Session.
int
ACE_RAPI_Session::close (void)
{
  this->rsvp_error = rapi_release(this->session_id_);

  if (rsvp_error == 0)
    ACELIB_ERROR_RETURN ((LM_ERROR,
                       "Can't release RSVP session:\n\t%s\n",
                       rapi_errlist[rsvp_error]),
                      -1);
  else
    ACELIB_DEBUG ((LM_DEBUG,
                "rapi session with id %d released successfully.\n",
                this->session_id_));
  return 0;
}
開發者ID:AtVirus,項目名稱:SkyFireEMU,代碼行數:17,代碼來源:QoS_Session_Impl.cpp

示例9: ACE_TRACE

int
ACE_Name_Proxy::request_reply (ACE_Name_Request &request)
{
  ACE_TRACE ("ACE_Name_Proxy::request_reply");
  void *buffer;
  ssize_t length = request.encode (buffer);

  if (length == -1)
    ACELIB_ERROR_RETURN ((LM_ERROR,
                       ACE_TEXT ("%p\n"),
                       ACE_TEXT ("encode failed")),
                      -1);

  // Transmit request via a blocking send.

  if (this->peer_.send_n (buffer, length) != length)
    ACELIB_ERROR_RETURN ((LM_ERROR,
                       ACE_TEXT ("%p\n"),
                       ACE_TEXT ("send_n failed")),
                      -1);
  else
    {
      ACE_Name_Reply reply;

      // Receive reply via blocking read.

      if (this->peer_.recv_n (&reply,
                              sizeof reply) == -1)
        ACELIB_ERROR_RETURN ((LM_ERROR,
                           ACE_TEXT ("%p\n"),
                           ACE_TEXT ("recv failed")),
                          -1);
      else if (reply.decode () == -1)
        ACELIB_ERROR_RETURN ((LM_ERROR,
                           ACE_TEXT ("%p\n"),
                           ACE_TEXT ("decode failed")),
                          -1);
      errno = int (reply.errnum ());
      return reply.status ();
    }
}
開發者ID:GlassFace,項目名稱:sunwell,代碼行數:41,代碼來源:Name_Proxy.cpp

示例10: ACE_TRACE

// Compute the new map_size of the backing store and commit the
// memory.
int
ACE_MMAP_Memory_Pool::commit_backing_store_name (size_t rounded_bytes,
                                                 size_t & map_size)
{
  ACE_TRACE ("ACE_MMAP_Memory_Pool::commit_backing_store_name");

#if defined (__Lynx__)
  map_size = rounded_bytes;
#else
  size_t seek_len;

  if (this->write_each_page_)
    // Write to the end of every block to ensure that we have enough
    // space in the backing store.
    seek_len = this->round_up (1); // round_up(1) is one page.
  else
    // We're willing to risk it all in the name of efficiency...
    seek_len = rounded_bytes;

  // The following loop will execute multiple times (if
  // this->write_each_page == 1) or just once (if
  // this->write_each_page == 0).

  for (size_t cur_block = 0;
       cur_block < rounded_bytes;
       cur_block += seek_len)
    {
      map_size =
        ACE_Utils::truncate_cast<size_t> (
          ACE_OS::lseek (this->mmap_.handle (),
                         static_cast<ACE_OFF_T> (seek_len - 1),
                         SEEK_END));

      if (map_size == static_cast<size_t> (-1)
          || ACE_OS::write (this->mmap_.handle (),
                            "",
                            1) == -1)
        ACELIB_ERROR_RETURN ((LM_ERROR,
                           ACE_TEXT ("(%P|%t) %p\n"),
                           this->backing_store_name_),
                          -1);
    }

#if defined (ACE_OPENVMS)
  ::fsync(this->mmap_.handle());
#endif

  // Increment by one to put us at the beginning of the next chunk...
  ++map_size;
#endif /* __Lynx__ */
  return 0;
}
開發者ID:Arkania,項目名稱:ArkCORE-NG,代碼行數:54,代碼來源:MMAP_Memory_Pool.cpp

示例11: ACELIB_ERROR_RETURN

int
ACE_ARGV_T<CHAR_TYPE>::add (const CHAR_TYPE *next_arg, bool quote_arg)
{
  // Only allow this to work in the "iterative" verion -- the
  // ACE_ARGVs created with the one argument constructor.
  if (!this->iterative_)
    {
      errno = EINVAL;
      return -1;
    }

  this->length_ += ACE_OS::strlen (next_arg);
  if (quote_arg && ACE_OS::strchr (next_arg, ' ') != 0)
    {
      this->length_ += 2;
      if (ACE_OS::strchr (next_arg, '"') != 0)
        for (const CHAR_TYPE * p = next_arg; *p != '\0'; ++p)
          if (*p == '"') ++this->length_;
    }
  else
    {
      quote_arg = false;
    }

  // Put the new argument at the end of the queue.
  if (this->queue_.enqueue_tail (ACE_ARGV_Queue_Entry_T<CHAR_TYPE> (next_arg, quote_arg)) == -1)
    ACELIB_ERROR_RETURN ((LM_ERROR,
                       ACE_TEXT ("Can't add more to ARGV queue")),
                      -1);

  ++this->argc_;

  // Wipe argv_ and buf_ away so that they will be recreated if the
  // user calls argv () or buf ().
  if (this->argv_ != 0)
    {
      for (int i = 0; this->argv_[i] != 0; i++)
        ACE_OS::free ((void *) this->argv_[i]);

      delete [] this->argv_;
      this->argv_ = 0;
    }

  delete [] this->buf_;
  this->buf_ = 0;

  return 0;
}
開發者ID:GlassFace,項目名稱:sunwell,代碼行數:48,代碼來源:ARGV.cpp

示例12: ACELIB_ERROR_RETURN

    size_t
    Monitor_Base::count (void) const
    {
      if (this->data_.type_ == Monitor_Control_Types::MC_GROUP)
        {
          ACELIB_ERROR_RETURN ((LM_ERROR,
                             ACE_TEXT ("count: %s is a monitor group\n"),
                             this->name_.c_str ()),
                            0UL);
        }

      ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, guard, this->mutex_, 0UL);

      return (this->data_.type_ == Monitor_Control_Types::MC_COUNTER
              ? static_cast<size_t> (this->data_.last_)
              : this->data_.index_);
    }
開發者ID:DOCGroup,項目名稱:ACE_TAO,代碼行數:17,代碼來源:Monitor_Base.cpp

示例13: ACELIB_ERROR_RETURN

template <class HANDLER> int
ACE_Asynch_Connector<HANDLER>::connect (const ACE_INET_Addr & remote_sap,
                                        const ACE_INET_Addr & local_sap,
                                        int reuse_addr,
                                        const void *act)
{
  // Initiate asynchronous connect
  if (this->asynch_connect_.connect (ACE_INVALID_HANDLE,
                                     remote_sap,
                                     local_sap,
                                     reuse_addr,
                                     act) == -1)
    ACELIB_ERROR_RETURN ((LM_ERROR,
                       ACE_TEXT ("%p\n"),
                       ACE_TEXT ("ACE_Asynch_Connect::connect")),
                      -1);
  return 0;
}
開發者ID:Adeer,項目名稱:OregonCore,代碼行數:18,代碼來源:Asynch_Connector.cpp

示例14: ACE_TRACE

void *
ACE_Sbrk_Memory_Pool::acquire (size_t nbytes,
                               size_t &rounded_bytes)
{
  ACE_TRACE ("ACE_Sbrk_Memory_Pool::acquire");
  rounded_bytes = this->round_up (nbytes);
  // ACELIB_DEBUG ((LM_DEBUG,  ACE_TEXT ("(%P|%t) acquiring more chunks, nbytes = %d, rounded_bytes = %d\n"), nbytes, rounded_bytes));
  void *cp = ACE_OS::sbrk (rounded_bytes);

  if (cp == MAP_FAILED)
    ACELIB_ERROR_RETURN ((LM_ERROR,
                       "(%P|%t) cp = %u\n",
                       cp),
                      0);
  else
    // ACELIB_DEBUG ((LM_DEBUG,  ACE_TEXT ("(%P|%t) acquired more chunks, nbytes = %d, rounded_bytes = %d, new break = %u\n"), nbytes, rounded_bytes, cp));
  return cp;
}
開發者ID:GlassFace,項目名稱:sunwell,代碼行數:18,代碼來源:Sbrk_Memory_Pool.cpp

示例15: ACE_NEW_RETURN

rapi_flowspec_t *
ACE_RAPI_Session::init_flowspec_simplified(const ACE_Flow_Spec &flow_spec)
{
  rapi_flowspec_t *flowsp;
  ACE_NEW_RETURN (flowsp,
                  rapi_flowspec_t,
                  0);

  // Extended Legacy format.
  qos_flowspecx_t *csxp = &flowsp->specbody_qosx;

  // Choose based on the service type : [QOS_GUARANTEEDX/QOS_CNTR_LOAD].

  switch (flow_spec.service_type ())
    {
    case QOS_GUARANTEEDX:
      csxp->xspec_R = 0 ; // Guaranteed Rate B/s. @@How does this map to the
                          // ACE Flow Spec Parameters.

      csxp->xspec_S = flow_spec.delay_variation () ; // Slack term in MICROSECONDS

      // Note there is no break !!

    case QOS_CNTR_LOAD:
      csxp->spec_type = flow_spec.service_type ();        // qos_service_type
      csxp->xspec_r = flow_spec.token_rate ();            // Token Bucket Average Rate (B/s)
      csxp->xspec_b = flow_spec.token_bucket_size ();     // Token Bucket Rate (B)
      csxp->xspec_p = flow_spec.peak_bandwidth ();        // Peak Data Rate (B/s)
      csxp->xspec_m = flow_spec.minimum_policed_size ();  // Minimum Policed Unit (B)

      csxp->xspec_M = flow_spec.max_sdu_size();          // Max Packet Size (B)

      flowsp->form = RAPI_FLOWSTYPE_Simplified;
      break;

    default:
      ACELIB_ERROR_RETURN ((LM_ERROR,
                         "(%N|%l) Unknown flowspec type: %u\n",flow_spec.service_type () ),
                        0);
    }

  flowsp->len = sizeof(rapi_flowspec_t);
  return flowsp;
}
開發者ID:AtVirus,項目名稱:SkyFireEMU,代碼行數:44,代碼來源:QoS_Session_Impl.cpp


注:本文中的ACELIB_ERROR_RETURN函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。