本文整理汇总了C++中OsTask::id方法的典型用法代码示例。如果您正苦于以下问题:C++ OsTask::id方法的具体用法?C++ OsTask::id怎么用?C++ OsTask::id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OsTask
的用法示例。
在下文中一共展示了OsTask::id方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read
OsStatus OsFileBase::read(void* buf, size_t buflen, size_t& bytesRead)
{
OsLock lock(fileMutex);
#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::read ENTER threadid=%ld\n", nTaskId);
#endif
OsStatus stat = OS_INVALID;
if (mOsFileHandle)
{
bytesRead = ::fread(buf,1,buflen,mOsFileHandle);
if (bytesRead == 0 && feof(mOsFileHandle))
stat = OS_FILE_EOF;
else
stat = OS_SUCCESS;
if (ferror(mOsFileHandle))
stat = OS_FILE_INVALID_HANDLE;
}
else
stat = OS_FILE_INVALID_HANDLE;
#ifdef DEBUG_FS
Os::Logger::instance().log(FAC_KERNEL, PRI_DEBUG, "OsFileBase::read EXIT threadid=%ld\n", nTaskId);
#endif
return stat;
}
示例2: getPosition
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;
}
示例3: 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;
}
示例4: 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;
}
示例5: setPosition
OsStatus OsFileBase::setPosition(ssize_t pos, FilePositionOrigin origin)
{
OsLock lock(fileMutex);
#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::setPosition ENTER threadid=%ld\n", nTaskId);
#endif
OsStatus stat = OS_INVALID;
if (mOsFileHandle)
{
int startloc = -1;
if (origin == START)
startloc = SEEK_SET;
else
if (origin == CURRENT)
startloc = SEEK_CUR;
else
if (origin == END)
startloc = SEEK_END;
if (startloc != -1 && fseek(mOsFileHandle,pos,startloc) != -1)
stat = OS_SUCCESS;
}
#ifdef DEBUG_FS
Os::Logger::instance().log(FAC_KERNEL, PRI_DEBUG, "OsFileBase::setPosition EXIT threadid=%ld\n", nTaskId);
#endif
return stat;
}
示例6: send
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);
}
示例7: 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
}
示例8: 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;
}
示例9: 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;
}
示例10: 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
}
示例11: 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;
}
示例12: 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;
}
示例13: 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
}
示例14: rename
OsStatus OsFileBase::rename(const OsPathBase& rNewFilename)
{
OsLock lock(fileMutex);
#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::rename ENTER threadid=%ld\n", nTaskId);
#endif
OsStatus ret = OS_INVALID;
//if it's open then close it
close();
int err = ::rename(mFilename.data(),rNewFilename.data());
if (err != -1)
{
ret = OS_SUCCESS;
}
else
{
// Rename failed, if there is a file that already exists having
// the new name, try removing it first
OsFile fileInPlace(rNewFilename);
if(fileInPlace.exists())
{
fileInPlace.remove(TRUE);
// Try the move again
int err2 = ::rename(mFilename.data(),rNewFilename.data());
if (err2 != -1)
{
ret = OS_SUCCESS;
}
}
}
#ifdef DEBUG_FS
Os::Logger::instance().log(FAC_KERNEL, PRI_DEBUG, "OsFileBase::rename EXIT threadid=%ld\n", nTaskId);
#endif
return ret;
}
示例15: 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;
}