本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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);
}
示例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
}
示例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;
}
示例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;
}
示例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
}
示例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;
}
示例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
}
示例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;
}
示例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
}
示例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;
}
示例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;
}
示例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 ] */
}