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


C++ ACE_MT函數代碼示例

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


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

示例1: ACE_MT

MgSecurityManager::~MgSecurityManager()
{
    ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, sm_mutex));

    m_securityCache = NULL;
}
開發者ID:kanbang,項目名稱:Colt,代碼行數:6,代碼來源:SecurityManager.cpp

示例2: ACE_MT

int
TAO_Stub::create_ior_info (IOP::IOR *&ior_info, CORBA::ULong &index)
{
  // We are creating the IOR info. Let us not be disturbed. So grab a
  // lock.
  ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
                            guard,
                            this->profile_lock_,
                            -1));
  if (TAO_debug_level > 5)
    {
      TAOLIB_DEBUG ((LM_DEBUG,
                  ACE_TEXT ("TAO (%P|%t) - Stub::create_ior_info, acquired ")
                  ACE_TEXT ("profile lock this = 0x%x\n"),
                  this));
    }


  IOP::IOR *tmp_info = 0;

  if (this->forward_profiles_ != 0)
    {
      if (this->forwarded_ior_info_ == 0)
        {
          this->get_profile_ior_info (*this->forward_profiles_, tmp_info);

          this->forwarded_ior_info_ = tmp_info;
        }

      // First we look at the forward profiles to see whether the
      // profile_in_use is any of it.
      for (CORBA::ULong i = 0;
           i < this->forward_profiles_->profile_count ();
           ++i)
        {
          if (this->forward_profiles_->get_profile (i)
              == this->profile_in_use_)
            {
              ior_info = this->forwarded_ior_info_;
              index = i;
              return 0;
            }
        }
    }

  // Else we look at the base profiles
  if (this->ior_info_ == 0)
    {
      this->get_profile_ior_info (this->base_profiles_, tmp_info);

      this->ior_info_ = tmp_info;
    }


  for (CORBA::ULong ind = 0;
       ind < this->base_profiles_.profile_count ();
       ++ind)
    {
      if (this->base_profiles_.get_profile (ind) == this->profile_in_use_)
        {
          index = ind;
          ior_info = this->ior_info_;
          return 0;
        }
    }

  // Error, there was no match
  return -1;
}
開發者ID:OspreyHub,項目名稱:ATCD,代碼行數:69,代碼來源:Stub.cpp

示例3: ACE_TRACE

pid_t
ACE_Process_Manager::wait (pid_t pid,
                           const ACE_Time_Value &timeout,
                           ACE_exitcode *status)
{
  ACE_TRACE ("ACE_Process_Manager::wait");

  ACE_exitcode local_stat = 0;
  if (status == 0)
    status = &local_stat;

  *status = 0;

  ssize_t idx = -1;
  ACE_Process *proc = 0;

  {
    // fake context after which the lock is released
    ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1));

    if (pid != 0)
      {
        idx = this->find_proc (pid);
        if (idx == -1)
          return ACE_INVALID_PID;
        else
          proc = process_table_[idx].process_;
      }
    // release the lock.
  }
  if (proc != 0)
    pid = proc->wait (timeout, status);
  else
    {
      ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1));
      // Wait for any Process spawned by this Process_Manager.
#if defined (ACE_WIN32)
      HANDLE *handles = 0;

      ACE_NEW_RETURN (handles,
                      HANDLE[this->current_count_],
                      ACE_INVALID_PID);

      for (size_t i = 0;
           i < this->current_count_;
           ++i)
        handles[i] =
          process_table_[i].process_->gethandle ();

      DWORD handle_count = static_cast<DWORD> (this->current_count_);
      DWORD result = ::WaitForMultipleObjects (handle_count,
                                               handles,
                                               FALSE,
                                               timeout == ACE_Time_Value::max_time
                                               ? INFINITE
                                               : timeout.msec ());
      if (result == WAIT_FAILED)
        pid = ACE_INVALID_PID;
      else if (result == WAIT_TIMEOUT)
        pid = 0;
      else
        {
          // Green Hills produces a warning that result >=
          // WAIT_OBJECT_0 is a pointless comparison because
          // WAIT_OBJECT_0 is zero and DWORD is unsigned long, so this
          // test is skipped for Green Hills.  Same for mingw.
# if defined (ghs) || defined (__MINGW32__) || defined (_MSC_VER)
          ACE_ASSERT (result < WAIT_OBJECT_0 + this->current_count_);
# else
          ACE_ASSERT (result >= WAIT_OBJECT_0
                      && result < WAIT_OBJECT_0 + this->current_count_);
# endif

          idx = this->find_proc (handles[result - WAIT_OBJECT_0]);

          if (idx != -1)
            {
              pid = process_table_[idx].process_->getpid ();
              result = ::GetExitCodeProcess (handles[result - WAIT_OBJECT_0],
                                             status);
              if (result == 0)
                {
                  // <GetExitCodeProcess> failed!
                  this->remove_proc (idx);
                  pid = ACE_INVALID_PID;
                }
            }
          else
            {
              // uh oh...handle removed from process_table_, even though
              // we're holding a lock!
              delete [] handles;
              ACE_ERROR_RETURN ((LM_ERROR,
                                 ACE_TEXT ("Process removed")
                                 ACE_TEXT (" -- somebody's ignoring the lock!\n")),
                                -1);
            }
        }

      delete [] handles;
//.........這裏部分代碼省略.........
開發者ID:Blumfield,項目名稱:TBCPvP,代碼行數:101,代碼來源:Process_Manager.cpp

示例4: ACE_TRACE

/// Insert the ACE_Service_Type SR into the repository.  Note that
/// services may be inserted either resumed or suspended. Using same
/// name as in an existing service causes the delete () to be called
/// for the old one, i.e. make sure @code sr is allocated on the heap!
int
ACE_Service_Repository::insert (const ACE_Service_Type *sr)
{
  ACE_TRACE ("ACE_Service_Repository::insert");

  size_t i = 0;
  int return_value = -1;
  ACE_Service_Type const *s = 0;

  // Establish scope for locking while manipulating the service
  // storage
  {
    // @TODO: Do we need a recursive mutex here?
    ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex,
                              ace_mon,
                              this->lock_,
                              -1));

    return_value = find_i (sr->name (), i, &s, false);

    // Adding an entry.
    if (s != 0)
      {
        this->service_array_[i] = sr;
      }
    else
      {
        // New services are always added where current_size_ points,
        // because if any DLL relocation needs to happen, it will be
        // performed on services with indexes between some old
        // current_size_ and the new current_size_ value.  See
        // ACE_Service_Type_Dynamic_Guard ctor and dtor for details.

        if (i < this->service_array_.size ())
          i = this->service_array_.size ();

        this->service_array_[i] = sr;
        return_value = 0;
      }
  }
#ifndef ACE_NLOGGING
  if (ACE::debug ())
    ACE_DEBUG ((LM_DEBUG,
                ACE_TEXT ("ACE (%P|%t) SR::insert - repo=%@ [%d],")
                ACE_TEXT (" name=%s (%C) (type=%@, object=%@, active=%d)\n"),
                this,
                i,
                sr->name(),
                (return_value == 0 ? ((s==0) ? "new" : "replacing") : "failed"),
                sr->type (),
                (sr->type () != 0) ? sr->type ()->object () : 0,
                sr->active ()));
#endif

  // If necessary, delete but outside the lock. (s may be 0, but
  // that's okay, too)
  delete s;

  if (return_value == -1)
    ACE_OS::last_error (ENOSPC);

  return return_value;
}
開發者ID:Dudelzack,項目名稱:blizzlikecore,代碼行數:67,代碼來源:Service_Repository.cpp

示例5: ACE_TRACE

int
ACE_DLL_Handle::open (const ACE_TCHAR *dll_name,
                      int open_mode,
                      ACE_SHLIB_HANDLE handle)
{
  ACE_TRACE ("ACE_DLL_Handle::open");
  ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0));

  if (this->dll_name_)
    {
      // Once dll_name_ has been set, it can't be changed..
      if (ACE_OS::strcmp (this->dll_name_, dll_name) != 0)
        {
          if (ACE::debug ())
            ACE_ERROR ((LM_ERROR,
                        ACE_TEXT ("(%P|%t) DLL_Handle::open: error, ")
                        ACE_TEXT ("tried to reopen %s with name %s\n"),
                        this->dll_name_,
                        dll_name));

          return -1;
        }
    }
  else
    this->dll_name_ = ACE::strnew (dll_name);

  if (!this->open_called_)
    this->open_called_ = 1;

  // If it hasn't been loaded yet, go ahead and do that now.
  if (this->handle_ == ACE_SHLIB_INVALID_HANDLE)
    {
      if (handle)
        this->handle_ = handle;
      else
        {
          /*
          ** Get the set of names to try loading. We need to do this to
          ** properly support the ability for a user to specify a simple,
          ** unadorned name (for example, "ACE") that will work across
          ** platforms. We apply platform specifics to get a name that will
          ** work (e.g. libACE, ACEd.dll, ACE.dll, etc.) We rely on the
          ** underlying dlopen() implementation to "Do The Right Thing" in
          ** terms of using relative paths, LD_LIBRARY_PATH, system security
          ** rules, etc. except when ACE_MUST_HELP_DLOPEN_SEARCH_PATH is set.
          ** If it is set, then ACE::ldfind() scans the configured path
          ** looking for a match on the name and prefix/suffix applications.
          ** NOTE: having ACE scan for a file and then pass a fully-qualified
          ** pathname to dlopen() is a potential security hole; therefore,
          ** do not use ACE_MUST_HELP_DLOPEN_SEARCH_PATH unless necessary
          ** and only after considering the risks.
          */
          ACE_Array<ACE_TString> dll_names;
          dll_names.max_size (10);    // Decent guess to avoid realloc later

#if defined (ACE_MUST_HELP_DLOPEN_SEARCH_PATH)
          // Find out where the library is
          ACE_TCHAR dll_pathname[MAXPATHLEN + 1];

          // Transform the pathname into the appropriate dynamic link library
          // by searching the ACE_LD_SEARCH_PATH.
          ACE::ldfind (dll_name,
                       dll_pathname,
                       (sizeof dll_pathname / sizeof (ACE_TCHAR)));
          ACE_TString dll_str (dll_pathname);
          dll_names.size (1);
          dll_names.set (dll_str, 0);
#else
          this->get_dll_names (dll_name, dll_names);
#endif

          ACE_Array_Iterator<ACE_TString> name_iter (dll_names);
          ACE_TString *name = 0;
          while (name_iter.next (name))
            {
              // The ACE_SHLIB_HANDLE object is obtained.
              this->handle_ = ACE_OS::dlopen (name->c_str (),
                                              open_mode);

              if (ACE::debug ())
                {
                  ACE_DEBUG ((LM_DEBUG,
                              ACE_TEXT ("ACE (%P|%t) DLL_Handle::open ")
                              ACE_TEXT ("(\"%s\", 0x%x) -> %s: %s\n"),
                              name->c_str (),
                              open_mode,
                              ((this->handle_ != ACE_SHLIB_INVALID_HANDLE)
                               ? ACE_TEXT ("succeeded")
                               : ACE_TEXT ("failed")),
                              this->error()->c_str()));
                }

              if (this->handle_ != ACE_SHLIB_INVALID_HANDLE)   // Good one?
                break;

              // If errno is ENOENT we just skip over this one,
              // anything else - like an undefined symbol, for
              // instance must be flagged here or the next error will
              // mask it.
              // @TODO: If we've found our DLL _and_ it's
//.........這裏部分代碼省略.........
開發者ID:yuanxu,項目名稱:liveshow_r2,代碼行數:101,代碼來源:DLL_Manager.cpp

示例6: ACE_TRACE

// Insert the ACE_Service_Type SR into the repository.  Note that
// services may be inserted either resumed or suspended. Using same
// name as in an existing service causes the delete () to be called
// for the old one, i.e. make sure @code sr is allocated on the heap!
int
ACE_Service_Repository::insert (const ACE_Service_Type *sr)
{
    ACE_TRACE ("ACE_Service_Repository::insert");

    size_t i = 0;
    int return_value = -1;
    ACE_Service_Type const *s = 0;

    // Establish scope for locking while manipulating the service
    // storage
    {
        // @TODO: Do we need a recursive mutex here?
        ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex,
                                  ace_mon,
                                  this->lock_,
                                  -1));

        return_value = find_i (sr->name (), i, &s, false);

        // Adding an entry.
        if (s != 0)
        {
            this->service_vector_[i] = sr;
        }
        else
        {
            // New services are always added where current_size_ points,
            // because if any DLL relocation needs to happen, it will be
            // performed on services with indexes between some old
            // current_size_ and the new current_size_ value.  See
            // ACE_Service_Type_Dynamic_Guard ctor and dtor for details.

            if (i < this->current_size_)
                i = this->current_size_;

            if (i < this->total_size_)
            {
                this->service_vector_[i] = sr;
                this->current_size_++;
                return_value = 0;
            }
            else
            {
                return_value = -1; // no space left
            }

            // Since there may be "holes" left by removed services one
            // could consider wrapping current_size_ modulo
            // total_size_. This is going to impact
            // ACE_Service_Type_Dynamic_Guard, too and is tricky. Perhaps
            // a new directive, like "reload" would be better as it can
            // combine the removal and insertion in an atomic step and
            // avoid creating too many "holes".
        }
    }
#ifndef ACE_NLOGGING
    if (ACE::debug ())
        ACE_DEBUG ((LM_DEBUG,
                    ACE_TEXT ("ACE (%P|%t) SR::insert - repo=%@ [%d] (%d),")
                    ACE_TEXT (" name=%s (%s) (type=%@, object=%@, active=%d)\n"),
                    this,
                    i,
                    this->total_size_,
                    sr->name(),
                    (return_value == 0 ? ((s==0) ? "new" : "replacing") : "failed"),
                    sr->type (),
                    (sr->type () != 0) ? sr->type ()->object () : 0,
                    sr->active ()));
#endif

    // If necessary, delete but outside the lock. (s may be 0, but
    // that's okay, too)
    delete s;

    if (return_value == -1)
        ACE_OS::last_error (ENOSPC);

    return return_value;
}
開發者ID:avesoft,項目名稱:diamondcore2,代碼行數:84,代碼來源:Service_Repository.cpp

示例7: ACE_MT

int
ACE_SSL_Context::set_mode (int mode)
{
    ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex,
                              ace_ssl_mon,
                              *ACE_Static_Object_Lock::instance (),
                              -1));

    if (this->context_ != 0)
        return -1;

#if OPENSSL_VERSION_NUMBER >= 0x10000002
    const SSL_METHOD *method = 0;
#else
    SSL_METHOD *method = 0;
#endif

    switch (mode)
    {
    case ACE_SSL_Context::SSLv2_client:
        method = ::SSLv2_client_method ();
        break;
    case ACE_SSL_Context::SSLv2_server:
        method = ::SSLv2_server_method ();
        break;
    case ACE_SSL_Context::SSLv2:
        method = ::SSLv2_method ();
        break;
    case ACE_SSL_Context::SSLv3_client:
        method = ::SSLv3_client_method ();
        break;
    case ACE_SSL_Context::SSLv3_server:
        method = ::SSLv3_server_method ();
        break;
    case ACE_SSL_Context::SSLv3:
        method = ::SSLv3_method ();
        break;
    case ACE_SSL_Context::SSLv23_client:
        method = ::SSLv23_client_method ();
        break;
    case ACE_SSL_Context::SSLv23_server:
        method = ::SSLv23_server_method ();
        break;
    case ACE_SSL_Context::SSLv23:
        method = ::SSLv23_method ();
        break;
    case ACE_SSL_Context::TLSv1_client:
        method = ::TLSv1_client_method ();
        break;
    case ACE_SSL_Context::TLSv1_server:
        method = ::TLSv1_server_method ();
        break;
    case ACE_SSL_Context::TLSv1:
        method = ::TLSv1_method ();
        break;
    default:
        method = ::SSLv3_method ();
        break;
    }

    this->context_ = ::SSL_CTX_new (method);
    if (this->context_ == 0)
        return -1;

    this->mode_ = mode;

    // Load the trusted certificate authority (default) certificate
    // locations. But do not return -1 on error, doing so confuses CTX
    // allocation (severe error) with the less important loading of CA
    // certificate location error.  If it is important for your
    // application then call ACE_SSL_Context::have_trusted_ca(),
    // immediately following this call to set_mode().
    (void) this->load_trusted_ca ();

    return 0;
}
開發者ID:kanbang,項目名稱:Colt,代碼行數:76,代碼來源:SSL_Context.cpp

示例8: ACE_TRACE

int
ACE_SOCK_Dgram_Mcast::join (const ACE_INET_Addr &mcast_addr,
                            int reuse_addr,
                            const ACE_TCHAR *net_if)
{
  ACE_TRACE ("ACE_SOCK_Dgram_Mcast::join");
  ACE_INET_Addr subscribe_addr = mcast_addr;

  // If port# is 0, insert bound port# if it is set. (To satisfy lower-level
  // port# validation.)
  u_short def_port_number = this->send_addr_.get_port_number ();
  if (subscribe_addr.get_port_number () == 0
      && def_port_number != 0)
    {
      subscribe_addr.set_port_number (def_port_number);
    }

  // Check for port# different than bound port#.
  u_short sub_port_number = mcast_addr.get_port_number ();
  if (sub_port_number != 0
      && def_port_number != 0
      && sub_port_number != def_port_number)
    {
      ACE_ERROR ((LM_ERROR,
                  ACE_LIB_TEXT ("Subscribed port# (%u) different than bound ")
                  ACE_LIB_TEXT ("port# (%u).\n"),
                  (u_int) sub_port_number,
                  (u_int) def_port_number));
      errno = ENXIO;
      return -1;
    }

  // If bind_addr_opt_ is enabled, check for address different than
  // bound address.
#if defined (__linux__) && defined (ACE_HAS_IPV6)
  if (ACE_BIT_ENABLED (this->opts_, OPT_BINDADDR_YES)
      && ((this->send_addr_.get_type () == AF_INET
          && this->send_addr_.get_ip_address () != INADDR_ANY
          && this->send_addr_.get_ip_address () != mcast_addr.get_ip_address ())
      || (this->send_addr_.get_type () == AF_INET6 &&
          ACE_OS::memcmp
          (&((sockaddr_in6 *) this->send_addr_.get_addr ())->sin6_addr,
           &in6addr_any, sizeof (in6_addr)) != 0 &&
          ACE_OS::memcmp
          (&((sockaddr_in6 *) this->send_addr_.get_addr ())->sin6_addr,
           &((sockaddr_in6 *) mcast_addr.get_addr ())->sin6_addr,
           sizeof (in6_addr)) != 0)))
#else
  if (ACE_BIT_ENABLED (this->opts_, OPT_BINDADDR_YES)
      && this->send_addr_.get_ip_address () != INADDR_ANY
      && this->send_addr_.get_ip_address () != mcast_addr.get_ip_address ())
#endif /* __linux__ && ACE_HAS_IPV6 */
    {
      ACE_TCHAR sub_addr_string[MAXNAMELEN + 1];
      ACE_TCHAR bound_addr_string[MAXNAMELEN + 1];
      ACE_SDM_helpers::addr_to_string (mcast_addr, sub_addr_string,
                                       sizeof sub_addr_string, 1);
      ACE_SDM_helpers::addr_to_string (this->send_addr_, bound_addr_string,
                                       sizeof bound_addr_string, 1);
      ACE_ERROR ((LM_ERROR,
                  ACE_LIB_TEXT ("Subscribed address (%s) different than ")
                  ACE_LIB_TEXT ("bound address (%s).\n"),
                  sub_addr_string,
                  bound_addr_string));
      errno = ENXIO;
      return -1;
    }

  // Attempt subscription.
  int  result = this->subscribe_i (subscribe_addr, reuse_addr, net_if);

#if defined (ACE_SOCK_DGRAM_MCAST_DUMPABLE)
  if (result == 0)
    {
      // Add this addr/iface info to the list of subscriptions.
      // (Assumes this is unique addr/iface combo - most systems don't allow
      // re-sub to same addr/iface.)
      ip_mreq  *pmreq = new ip_mreq;
      // (should not fail)
      if (this->make_multicast_ifaddr (pmreq, subscribe_addr, net_if) != -1)
        {
          ACE_MT (ACE_GUARD_RETURN (ACE_SDM_LOCK, guard,
                                    this->subscription_list_lock_, -1));
          this->subscription_list_.insert_tail (pmreq);
          return 0;
        }
      // this still isn't really right. If ACE_GUARD_RETURN fails, we leak.
      // Need to add one of Chris' fancy ace auto pointers (bound?).
      delete pmreq;
    }
#endif /* ACE_SOCK_DGRAM_MCAST_DUMPABLE */

  return result >= 0 ? 0 : result;
}
開發者ID:mbert,項目名稱:mulberry-lib-jx,代碼行數:94,代碼來源:SOCK_Dgram_Mcast.cpp

示例9: ACE_MT

template <class TYPE, class FUNCTOR, class ACE_LOCK> void
ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::return_node (ACE_Timer_Node_T<TYPE> *node)
{
  ACE_MT (ACE_GUARD (ACE_LOCK, ace_mon, this->mutex_));
  this->free_node (node);
}
開發者ID:BackupTheBerlios,項目名稱:pyasynchio-svn,代碼行數:6,代碼來源:Timer_Queue_T.cpp

示例10: delay

/// <summary>
/// Pops a server connection from the top of the stack.  If
/// a connection is not available, one is created.  Stale connections
/// are dropped and not reused.
/// </summary>
/// <param name="connProp">
/// Connection to add
/// <param>
MgServerConnection* MgServerConnectionStack::Pop()
{
    // Wait up to 30 seconds for a connection to free up
    ACE_Time_Value delay(30);
    ACE_Time_Value future = ACE_OS::gettimeofday() + delay;
    int acquired = m_activeConnections.acquire(future);
    if (acquired == -1)
    {
        throw new MgConnectionFailedException(L"MgServerConnectionStack.Pop",
            __LINE__, __WFILE__, NULL, L"", NULL);
    }

    ACE_MT(ACE_GUARD_RETURN(ACE_Recursive_Thread_Mutex, ace_mon, m_mutex, NULL));

    MgServerConnection* conn = NULL;

    ACE_Time_Value now = ACE_High_Res_Timer::gettimeofday();

    // Pull a connection from the front of the queue and make sure it's valid.
    conn = NULL;
    while (NULL == conn && m_queue->size() > 0)
    {
        // Grab a connection from the queue
        {
            conn = m_queue->front();
            if (NULL != conn) m_queue->pop_front();
        }

        // And see if it is still valid
        if (NULL != conn)
        {
            if (conn->IsStale(&now))
            {
                SAFE_RELEASE(conn);
                conn = NULL;
            }
            else
            {
                // Check to see if stream is still alive... It better be!
                Ptr<MgStream> stream = conn->GetStream();
                if (stream != NULL)
                {
                    Ptr<MgStreamHelper> helper = stream->GetStreamHelper();
                    if (helper->IsConnected() == false)
                    {
                        stream = NULL;
                        SAFE_RELEASE(conn);
                        conn = NULL;
                    }
                }
                else
                {
                    SAFE_RELEASE(conn);
                    conn = NULL;
                }
            }
        }
    }

    if (NULL != conn)
    {
        InUse(conn);
    }

    // Extra reference count from InUse will be eating by external code
    return conn;
}
開發者ID:asir6,項目名稱:Colt,代碼行數:75,代碼來源:ServerConnectionStack.cpp

示例11: ACE_MT

void MgServerConnectionStack::InUse(MgServerConnection* connection)
{
    ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, m_mutex));
    SAFE_ADDREF(connection);
    m_inUse->push_back(connection);
}
開發者ID:asir6,項目名稱:Colt,代碼行數:6,代碼來源:ServerConnectionStack.cpp

示例12: ACE_MT

void KSG_Task_Queue::insert_task(task_type task)
{
	ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex,mon,_task_list_mutex));
	_list_of_tasks.push_front(task);
}
開發者ID:nykma,項目名稱:ykt4sungard,代碼行數:5,代碼來源:task_scheduler.cpp

示例13: defined

void
ACE_SOCK_Dgram_Mcast::dump (void) const
{
#if defined (ACE_HAS_DUMP)
  ACE_TRACE ("ACE_SOCK_Dgram_Mcast::dump");

  ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));

# if defined (ACE_SOCK_DGRAM_MCAST_DUMPABLE)
  ACE_TCHAR addr_string[MAXNAMELEN + 1];

  ACE_DEBUG ((LM_DEBUG,
              ACE_TEXT ("\nOptions: bindaddr=%s, nulliface=%s\n"),
              ACE_BIT_ENABLED (this->opts_, OPT_BINDADDR_YES) ?
                ACE_TEXT ("<Bound>") : ACE_TEXT ("<Not Bound>"),
              ACE_BIT_ENABLED (this->opts_, OPT_NULLIFACE_ALL) ?
                ACE_TEXT ("<All Ifaces>") : ACE_TEXT ("<Default Iface>")));

  // Show default send addr, port#, and interface.
  ACE_SDM_helpers::addr_to_string (this->send_addr_, addr_string,
                                   sizeof addr_string, 0);
  ACE_DEBUG ((LM_DEBUG,
              ACE_TEXT ("Send addr=%s iface=%s\n"),
              addr_string,
              this->send_net_if_ ? this->send_net_if_
                                 : ACE_TEXT ("<default>")));

  // Show list of subscribed addresses.
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Subscription list:\n")));

  ACE_MT (ACE_GUARD (ACE_SDM_LOCK, guard, this->subscription_list_lock_));
  subscription_list_iter_t  iter (this->subscription_list_);
  for ( ; !iter.done (); iter.advance ())
    {
      ACE_TCHAR iface_string[MAXNAMELEN + 1];
      ip_mreq *pm = iter.next ();

      // Get subscribed address (w/out port# info - not relevant).
      ACE_INET_Addr ip_addr (static_cast<u_short> (0),
                             ACE_NTOHL (pm->IMR_MULTIADDR.s_addr));
      ACE_SDM_helpers::addr_to_string (ip_addr, addr_string,
                                       sizeof addr_string, 1);

      // Get interface address/specification.
      ACE_INET_Addr if_addr (static_cast<u_short> (0),
                             ACE_NTOHL (pm->imr_interface.s_addr));
      ACE_SDM_helpers::addr_to_string (if_addr, iface_string,
                                       sizeof iface_string, 1);
      if (ACE_OS::strcmp (iface_string, ACE_TEXT ("0.0.0.0")) == 0)
        // Receives on system default iface. (Note that null_iface_opt_
        // option processing has already occurred.)
        ACE_OS::strcpy (iface_string, ACE_TEXT ("<default>"));

      // Dump info.
      ACE_DEBUG ((LM_DEBUG,
                  ACE_TEXT ("\taddr=%s iface=%s\n"),
                  addr_string,
                  iface_string));
    }
# endif /* ACE_SOCK_DGRAM_MCAST_DUMPABLE */
  ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
開發者ID:Amara1231,項目名稱:blizzlikecore,代碼行數:63,代碼來源:SOCK_Dgram_Mcast.cpp

示例14: ACE_MT

int KSG_Task_Queue::insert_task(task_type task)
{
	ACE_MT(ACE_GUARD_RETURN(ACE_Recursive_Thread_Mutex,mon,_task_list_mutex,-1));
	_list_of_tasks.push_front(task);
	return 0;
}
開發者ID:nykma,項目名稱:ykt4sungard,代碼行數:6,代碼來源:task_scheduler.cpp

示例15: ACE_TRACE

int
ACE_UPIPE_Connector::connect (ACE_UPIPE_Stream &new_stream,
                              const ACE_UPIPE_Addr &addr,
                              ACE_Time_Value *timeout,
                              const ACE_Addr & /* local_sap */,
                              int /* reuse_addr */,
                              int flags,
                              int perms)
{
  ACE_TRACE ("ACE_UPIPE_Connector::connect");
  ACE_ASSERT (new_stream.get_handle () == ACE_INVALID_HANDLE);

  ACE_HANDLE handle = ACE::handle_timed_open (timeout,
                                              addr.get_path_name (),
                                              flags, perms);

  if (handle == ACE_INVALID_HANDLE)
    return -1;
#if !defined (ACE_WIN32)
  else if (ACE_OS::isastream (handle) != 1)
    return -1;
#endif
  else // We're connected!
    {
      ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, new_stream.lock_, -1));

      ACE_UPIPE_Stream *ustream = &new_stream;

      new_stream.set_handle (handle);
      new_stream.remote_addr_ = addr; // class copy.
      new_stream.reference_count_++;

      // Now send the address of our ACE_UPIPE_Stream over this pipe
      // to our corresponding ACE_UPIPE_Acceptor, so he may link the
      // two streams.
      ssize_t result = ACE_OS::write (handle,
                                      (const char *) &ustream,
                                      sizeof ustream);
      if (result == -1)
        ACELIB_ERROR ((LM_ERROR,
                    ACE_TEXT ("ACE_UPIPE_Connector %p\n"),
                    ACE_TEXT ("write to pipe failed")));

      // Wait for confirmation of stream linking.
      ACE_Message_Block *mb_p = 0;

      // Our part is done, wait for server to confirm connection.
      result = new_stream.recv (mb_p, 0);

      // Do *not* coalesce the following two checks for result == -1.
      // They perform different checks and cannot be merged.
      if (result == -1)
          ACELIB_ERROR ((LM_ERROR,
                      ACE_TEXT ("ACE_UPIPE_Connector %p\n"),
                      ACE_TEXT ("no confirmation from server")));
      else
        // Close down the new_stream at this point in order to
        // conserve handles.  Note that we don't need the SPIPE
        // connection anymore since we're linked via the Message_Queue
        // now.
        new_stream.ACE_SPIPE::close ();
      return static_cast<int> (result);
    }
}
開發者ID:Adeer,項目名稱:OregonCore,代碼行數:64,代碼來源:UPIPE_Connector.cpp


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