コード例 #1
0
//ss_cc_change : This was relevant only when we supported nowait CLI
//LCOV_EXCL_START
Lng32 CliGlobals::dropContext(ContextCli* context)
{
  if (!context)
    return -1;

  if (context == getDefaultContext())
      return 0;

  CLISemaphore *tmpSemaphore = context->getSemaphore();
  tmpSemaphore->get();
  try
  {
     context->deleteMe();
  }
  catch (...)
  {
     tmpSemaphore->release();
     return -1;
  }
  tmpSemaphore->release();
  pid_t tid = syscall(SYS_gettid);
  cliSemaphore_->get();
  contextList_->remove((void*)context);
  tidList_->position();
  ContextTidMap *contextTidMap;
  while ((contextTidMap = (ContextTidMap *)tidList_->getNext()) != NULL)
  {
     if (contextTidMap->context_ == context)
     {
        if (contextTidMap->tid_  == tid)
        {
           tidList_->remove((char*)&contextTidMap->tid_, sizeof(pid_t), 
                          contextTidMap);
           NADELETE(contextTidMap, ContextTidMap, getExecutorMemory());
           tsCurrentContextMap = NULL; 
        }
        else
           contextTidMap->context_ = NULL;
     }
  } 
  delete context;
  cliSemaphore_->release();
  return 0;
}
コード例 #2
0
boost::shared_ptr<Context> DefaultReferenceResolver::getContext(boost::shared_ptr<Reference> ref)
{
    boost::shared_ptr<Context> con = getDefaultContext();
    if (ref->getContext().length() != 0) {
        if(ContextUtils::isRelative(ref->getContext()) && con != 0) {
            //TODO: con->get возвращает AgObject
            //con = con->get(ref->getContext(), getCallerController());
        }else if(getContextManager() != 0) {
            con = getContextManager()->get(ref->getContext(), getCallerController()) ;
        }else {
            con.reset();
        }

        if (con == NULL) {
            //TODO: exception
            //throw new ContextException(std::stringBuilder().append(Cres::get())->getString(u"conNotAvail"_j))->append(ref)->getContext())->toString());
        }
    }

    return con;
}