当前位置: 首页>>代码示例>>C++>>正文


C++ OsTask类代码示例

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


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

示例1: lock

OsStatus OsFileBase::getPosition(size_t &pos)
{
   OsLock lock(fileMutex);

   pos = (size_t) UTL_NOT_FOUND;

#ifdef DEBUG_FS
   pthread_t nTaskId = 0;
   OsTask* pTask = OsTask::getCurrentTask();
   if (pTask) pTask->id(nTaskId);
   Os::Logger::instance().log(FAC_KERNEL, PRI_DEBUG, "OsFileBase::getPosition ENTER threadid=%ld\n", nTaskId);
#endif

    OsStatus stat = OS_INVALID;

    if (mOsFileHandle)
    {
      pos = ftell(mOsFileHandle);
      if (pos != (size_t)UTL_NOT_FOUND)
      {
           stat = OS_SUCCESS;
      }
    }

#ifdef DEBUG_FS
   Os::Logger::instance().log(FAC_KERNEL, PRI_DEBUG, "OsFileBase::getPosition EXIT threadid=%ld\n", nTaskId);
#endif

    return stat;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:30,代码来源:OsFileBase.cpp

示例2: readLine

OsStatus OsFileBase::readLine(UtlString &str)
{
#ifdef DEBUG_FS
   pthread_t nTaskId = 0;
   OsTask* pTask = OsTask::getCurrentTask();
   if (pTask) pTask->id(nTaskId);
   Os::Logger::instance().log(FAC_KERNEL, PRI_DEBUG, "OsFileBase::readLine ENTER threadid=%ld\n", nTaskId);
#endif
    char buf[2];
    size_t bytesRead;
    OsStatus retstat = OS_INVALID;

    buf[1] = '\0';
    str.remove(0);
    do
    {
        retstat = read(buf, 1, bytesRead);

        if (retstat == OS_SUCCESS && (*buf != '\n' && *buf != '\r'))
        {
            str.append(buf, 1);
        }

    } while (retstat == OS_SUCCESS && bytesRead == 1 && *buf != '\n');


#ifdef DEBUG_FS
   Os::Logger::instance().log(FAC_KERNEL, PRI_DEBUG, "OsFileBase::readLine EXIT threadid=%ld\n", nTaskId);
#endif

   return retstat;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:32,代码来源:OsFileBase.cpp

示例3: getLength

OsStatus OsFileBase::getLength(size_t& flength)
{
#ifdef DEBUG_FS
   pthread_t nTaskId = 0;
   OsTask* pTask = OsTask::getCurrentTask();
   if (pTask) pTask->id(nTaskId);
   Os::Logger::instance().log(FAC_KERNEL, PRI_DEBUG, "OsFileBase::getLength ENTER threadid=%ld\n", (long)nTaskId);
#endif
    OsStatus ret = OS_INVALID;
    size_t saved_pos;

    if (getPosition(saved_pos) == OS_SUCCESS)
    {
        if (setPosition(0,END) == OS_SUCCESS)
        {
            if (getPosition(flength) == OS_SUCCESS)
            {
                if (setPosition(saved_pos,START) == OS_SUCCESS)
                {
                    ret = OS_SUCCESS;
                }
            }
        }
    }

#ifdef DEBUG_FS
   Os::Logger::instance().log(FAC_KERNEL, PRI_DEBUG, "OsFileBase::getLength EXIT threadid=%ld\n", (long)nTaskId);
#endif

   return ret;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:31,代码来源:OsFileBase.cpp

示例4: localIp

UtlBoolean SipProtocolServerBase::send(SipMessage* message,
                            const char* hostAddress,
                            int hostPort)
{
    UtlBoolean sendOk = FALSE;


    UtlString localIp(message->getLocalIp());
    
    if (localIp.length() < 1)
    {
        localIp = mDefaultIp;
    }

    SipClient* client = createClient(hostAddress, hostPort, localIp);
    if(client)
    {
        int isBusy = client->isInUseForWrite();
        UtlString clientNames;

        client->getClientNames(clientNames);
        OsSysLog::add(FAC_SIP, PRI_DEBUG, "Sip%sServerBase::send %p isInUseForWrite %d, client info\n %s",
                mProtocolString.data(), client, isBusy, clientNames.data());

        sendOk = client->sendTo(*message, hostAddress, hostPort);
        if(!sendOk)
        {
            OsTask* pCallingTask = OsTask::getCurrentTask();
            OsTaskId_t callingTaskId = -1;
            OsTaskId_t clientTaskId = -1;

            if ( pCallingTask )
            {
               pCallingTask->id(callingTaskId);
            }
            client->id(clientTaskId);

            if (clientTaskId != callingTaskId)
            {
               // Do not need to clientLock.acquireWrite();
               // as deleteClient uses the locking list lock
               // which is all that is needed as the client is
               // already marked as busy when we called
               // createClient above.
               deleteClient(client);
               client = NULL;
            }
        }
    }

        if(client)
        {
            releaseClient(client);
        }

    return(sendOk);
}
开发者ID:John-Chan,项目名称:sipXtapi,代码行数:57,代码来源:SipProtocolServerBase.cpp

示例5: close

// Destructor
OsFileBase::~OsFileBase()
{
#ifdef DEBUG_FS
   pthread_t nTaskId = 0;
   OsTask* pTask = OsTask::getCurrentTask();
   if (pTask) pTask->id(nTaskId);
   Os::Logger::instance().log(FAC_KERNEL, PRI_DEBUG, "OsFileBase::~OsFileBase ENTER threadid=%ld\n", (long)nTaskId);
#endif
    if (mOsFileHandle)
        close(); //call our close
#ifdef DEBUG_FS
   Os::Logger::instance().log(FAC_KERNEL, PRI_DEBUG, "OsFileBase::~OsFileBase EXIT threadid=%ld\n", (long)nTaskId);
#endif
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:15,代码来源:OsFileBase.cpp

示例6: fileunlock

OsStatus OsFileBase::fileunlock()
{
#ifdef DEBUG_FS
   pthread_t nTaskId = 0;
   OsTask* pTask = OsTask::getCurrentTask();
   if (pTask) pTask->id(nTaskId);
   Os::Logger::instance().log(FAC_KERNEL, PRI_DEBUG, "OsFileBase::fileunlock ENTER threadid=%ld\n", (long)nTaskId);
#endif
    OsStatus retval = OS_SUCCESS;
    //no file locking on the base class (yet) (I'm doing linux and windows first)
#ifdef DEBUG_FS
   Os::Logger::instance().log(FAC_KERNEL, PRI_DEBUG, "OsFileBase::fileunlock EXIT threadid=%ld\n", (long)nTaskId);
#endif
    return retval;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:15,代码来源:OsFileBase.cpp

示例7: setLength

OsStatus OsFileBase::setLength(unsigned long newLength)
{
#ifdef DEBUG_FS
   pthread_t nTaskId = 0;
   OsTask* pTask = OsTask::getCurrentTask();
   if (pTask) pTask->id(nTaskId);
   Os::Logger::instance().log(FAC_KERNEL, PRI_DEBUG, "OsFileBase::setLength ENTER threadid=%ld\n", nTaskId);
#endif
    OsStatus stat = OS_SUCCESS;

#ifdef DEBUG_FS
   Os::Logger::instance().log(FAC_KERNEL, PRI_DEBUG, "OsFileBase::setLength EXIT threadid=%ld\n", nTaskId);
#endif
    return stat;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:15,代码来源:OsFileBase.cpp

示例8: getFileName

void OsFileBase::getFileName(OsPathBase& rOsPath) const
{
#ifdef DEBUG_FS
   pthread_t nTaskId = 0;
   OsTask* pTask = OsTask::getCurrentTask();
   if (pTask) pTask->id(nTaskId);
   Os::Logger::instance().log(FAC_KERNEL, PRI_DEBUG, "OsFileBase::getFileName ENTER threadid=%ld\n", nTaskId);
#endif

   rOsPath = mFilename;

#ifdef DEBUG_FS
   Os::Logger::instance().log(FAC_KERNEL, PRI_DEBUG, "OsFileBase::getFileName EXIT threadid=%ld\n", nTaskId);
#endif
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:15,代码来源:OsFileBase.cpp

示例9: setReadOnly

OsStatus OsFileBase::setReadOnly(UtlBoolean isReadOnly)
{
#ifdef DEBUG_FS
   pthread_t nTaskId = 0;
   OsTask* pTask = OsTask::getCurrentTask();
   if (pTask) pTask->id(nTaskId);
   Os::Logger::instance().log(FAC_KERNEL, PRI_DEBUG, "OsFileBase::setReadOnly ENTER threadid=%ld\n", (long)nTaskId);
#endif

   OsStatus status = OsFileSystem::setReadOnly(mFilename,isReadOnly);

#ifdef DEBUG_FS
   Os::Logger::instance().log(FAC_KERNEL, PRI_DEBUG, "OsFileBase::setReadOnly EXIT threadid=%ld\n", (long)nTaskId);
#endif
    return status;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:16,代码来源:OsFileBase.cpp

示例10: switch

// Print semaphore information to the console
void OsBSemWnt::OsBSemShow(void)
{
   char* pOptionStr;
   char* pSemState;
   char* pTaskName;
#ifdef OS_SYNC_DEBUG
   UtlString taskName;
   OsTask* pTask;
#endif

   switch (mOptions)
   {
   case Q_FIFO:
      pOptionStr = "Q_FIFO";
      break;
   case Q_PRIORITY:
      pOptionStr = "Q_PRIORITY";
      break;
   default:
      pOptionStr = "UNKNOWN";
      break;
   }

#ifdef OS_SYNC_DEBUG
   pSemState = (mTaskId == 0) ? "AVAILABLE" : "TAKEN";
   if (mTaskId != 0)
   {
      pTask = OsTask::getTaskById(mTaskId);
      taskName = pTask->getName();
      pTaskName = (char*) taskName.data();

   }
   else
   {
      pTaskName = "N/A";
   }
#else
   pSemState = "UNKNOWN";
   pTaskName = "UNKNOWN";
#endif

   osPrintf("OsBSem object 0x%08x, semOptions=%s, state=%s, heldBy=%s\n",
            (void *) this, pOptionStr, pSemState, pTaskName);
#ifdef OS_SYNC_DEBUG
        taskName.remove(0);
#endif
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:48,代码来源:OsBSemWnt.cpp

示例11: isReadonly

UtlBoolean OsFileBase::isReadonly() const
{
#ifdef DEBUG_FS
   pthread_t nTaskId = 0;
   OsTask* pTask = OsTask::getCurrentTask();
   if (pTask) pTask->id(nTaskId);
   Os::Logger::instance().log(FAC_KERNEL, PRI_DEBUG, "OsFileBase::isReadonly ENTER threadid=%ld\n", (long)nTaskId);
#endif

    OsFileInfoBase info;
    getFileInfo(info);

#ifdef DEBUG_FS
   Os::Logger::instance().log(FAC_KERNEL, PRI_DEBUG, "OsFileBase::isReadonly EXIT threadid=%ld\n", (long)nTaskId);
#endif

    return info.mbIsReadOnly;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:18,代码来源:OsFileBase.cpp

示例12: fileMutex

// Copy constructor
OsFileBase::OsFileBase(const OsFileBase& rOsFileBase)
   : fileMutex(OsMutex::Q_FIFO),
     mFilename("")
{
#ifdef DEBUG_FS
   pthread_t nTaskId = 0;
   OsTask* pTask = OsTask::getCurrentTask();
   if (pTask) pTask->id(nTaskId);
   Os::Logger::instance().log(FAC_KERNEL, PRI_DEBUG, "OsFileBase::OsFileBase ENTER threadid=%ld\n", (long)nTaskId);
#endif
    OsPathBase path;
    rOsFileBase.getFileName(path);
    mFilename = path;
    mOsFileHandle = rOsFileBase.mOsFileHandle;
    mLocalLockThreadId = rOsFileBase.mLocalLockThreadId;
#ifdef DEBUG_FS
   Os::Logger::instance().log(FAC_KERNEL, PRI_DEBUG, "OsFileBase::OsFileBase EXIT threadid=%ld\n", (long)nTaskId);
#endif
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:20,代码来源:OsFileBase.cpp

示例13: remove

OsStatus OsFileBase::remove(UtlBoolean bForce)
{
#ifdef DEBUG_FS
   pthread_t nTaskId = 0;
   OsTask* pTask = OsTask::getCurrentTask();
   if (pTask) pTask->id(nTaskId);
   Os::Logger::instance().log(FAC_KERNEL, PRI_DEBUG, "OsFileBase::remove ENTER threadid=%ld\n", nTaskId);
#endif
    OsStatus ret = OS_INVALID;
    //if it's open then close it
    close();

    ret = OsFileSystem::remove(mFilename.data(),FALSE,bForce);

#ifdef DEBUG_FS
   Os::Logger::instance().log(FAC_KERNEL, PRI_DEBUG, "OsFileBase::remove EXIT threadid=%ld\n", nTaskId);
#endif

    return ret;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:20,代码来源:OsFileBase.cpp

示例14: exists

UtlBoolean OsFileBase::exists()
{
#ifdef DEBUG_FS
   pthread_t nTaskId = 0;
   OsTask* pTask = OsTask::getCurrentTask();
   if (pTask) pTask->id(nTaskId);
   Os::Logger::instance().log(FAC_KERNEL, PRI_DEBUG, "OsFileBase::exists ENTER threadid=%ld\n", (long)nTaskId);
#endif
    UtlBoolean stat = FALSE;

    OsFileInfo info;
    OsStatus retval = getFileInfo(info);
    if (retval == OS_SUCCESS)
        stat = TRUE;

#ifdef DEBUG_FS
   Os::Logger::instance().log(FAC_KERNEL, PRI_DEBUG, "OsFileBase::exists EXIT threadid=%ld\n", (long)nTaskId);
#endif

   return stat;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:21,代码来源:OsFileBase.cpp

示例15: lock

// Fires events to interested parties
void MpStreamFeeder::fireEvent(FeederEvent eventType)
{
   OsLock lock(m_eventGuard) ;

#ifdef MP_STREAM_DEBUG /* [ */
   osPrintf("MpStreamFeeder(%d): %s\n", m_iInstanceId, getEventString(eventType)) ;
#endif /* MP_STREAM_DEBUG ] */

   if (m_pEventHandler != NULL)
   {
      m_pEventHandler->signal(eventType) ;

      // Safe guard: once the destroyed event is signalled, the 
      // m_pEventHandler can be deleted.
      if (eventType == FeederStreamDestroyedEvent)
      {
         m_pEventHandler = NULL ;
      }

#ifdef MP_STREAM_DEBUG /* [ */
      pthread_t taskId = -1 ;
      OsTask *pTask = OsTask::getCurrentTask() ;
      if (pTask  != NULL)
      {
         pTask->id(taskId) ;
      }
      
      osPrintf("MpStreamFeeder(%d-%08X): signaled event: %s\n", 
         m_iInstanceId, taskId, getEventString(eventType)) ;
#endif /* MP_STREAM_DEBUG ] */

   } 
#ifdef MP_STREAM_DEBUG /* [ */
   else
   {
      osPrintf("** WARNING: Null handler for event: %s\n", getEventString(eventType)) ;
   }
#endif /* MP_STREAM_DEBUG ] */
}
开发者ID:mranga,项目名称:sipxecs,代码行数:40,代码来源:MpStreamFeeder.cpp


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