本文整理汇总了C++中OsTask::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ OsTask::getName方法的具体用法?C++ OsTask::getName怎么用?C++ OsTask::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OsTask
的用法示例。
在下文中一共展示了OsTask::getName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OsBSemShow
// 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
}
示例2: waitUntilAvailable
UtlBoolean SipTransactionList::waitUntilAvailable(SipTransaction* transaction,
const UtlString& hash)
{
UtlBoolean exists;
UtlBoolean busy = FALSE;
int numTries = 0;
do
{
numTries++;
lock();
exists = transactionExists(transaction, hash);
if(exists)
{
busy = transaction->isBusy();
if(!busy)
{
transaction->markBusy();
unlock();
//#ifdef TEST_PRINT
OsSysLog::add(FAC_SIP, PRI_DEBUG, "SipTransactionList::waitUntilAvailable %p locked after %d tries\n",
transaction, numTries);
//#endif
}
else
{
// We set an event to be signaled when a
// transaction is released.
OsEvent* waitEvent = new OsEvent;
transaction->notifyWhenAvailable(waitEvent);
// Must unlock while we wait or there is a dead lock
unlock();
//#ifdef TEST_PRINT
OsSysLog::add(FAC_SIP, PRI_DEBUG, "SipTransactionList::waitUntilAvailable %p waiting on: %p after %d tries\n",
transaction, waitEvent, numTries);
//#endif
OsStatus waitStatus;
OsTime transBusyTimeout(1, 0);
int waitTime = 0;
do
{
if(waitTime > 0)
OsSysLog::add(FAC_SIP, PRI_WARNING, "SipTransactionList::waitUntilAvailable %p still waiting: %d",
transaction, waitTime);
waitStatus = waitEvent->wait(transBusyTimeout);
waitTime+=1;
}
while(waitStatus != OS_SUCCESS && waitTime < 30);
// If we were never signaled, then we signal the
// event so the other side knows that it has to
// free up the event
if(waitEvent->signal(-1) == OS_ALREADY_SIGNALED)
{
delete waitEvent;
waitEvent = NULL;
}
// If we bailed out before the event was signaled
// pretend the transaction does not exist.
if(waitStatus != OS_SUCCESS)
{
exists = FALSE;
}
if(waitTime > 1)
{
if (OsSysLog::willLog(FAC_SIP, PRI_WARNING))
{
UtlString transTree;
UtlString waitingTaskName;
OsTask* waitingTask = OsTask::getCurrentTask();
if(waitingTask) waitingTaskName = waitingTask->getName();
transaction->dumpTransactionTree(transTree, FALSE);
OsSysLog::add(FAC_SIP, PRI_WARNING, "SipTransactionList::waitUntilAvailable status: %d wait time: %d transaction: %p task: %s transaction tree: %s",
waitStatus, waitTime, transaction, waitingTaskName.data(), transTree.data());
}
}
//#ifdef TEST_PRINT
OsSysLog::add(FAC_SIP, PRI_DEBUG, "SipTransactionList::waitUntilAvailable %p done waiting after %d tries\n",
transaction, numTries);
//#endif
}
}
else
{
unlock();
//#ifdef TEST_PRINT
OsSysLog::add(FAC_SIP, PRI_DEBUG, "SipTransactionList::waitUntilAvailable %p gone after %d tries\n",
transaction, numTries);
//#endif
}
}
//.........这里部分代码省略.........