Skip to content
Snippets Groups Projects
Commit fae92a2d authored by Tofu Linden's avatar Tofu Linden
Browse files

some clean-up of lllfsthread to help me understand it, remove one extraneous...

some clean-up of lllfsthread to help me understand it, remove one extraneous close().  to be reviewed by bao.
(transplanted from 17c6af7a2396f9890aab8226356a556b4d58a7d8)
parent 9f0f6106
No related branches found
No related tags found
No related merge requests found
......@@ -182,7 +182,7 @@ typedef LLAtomic32<U32> LLAtomicU32;
typedef LLAtomic32<S32> LLAtomicS32;
// File IO convenience functions.
// Returns NULL if the file fails to openm sets *sizep to file size of not NULL
// Returns NULL if the file fails to open, sets *sizep to file size if not NULL
// abbreviated flags
#define LL_APR_R (APR_READ) // "r"
#define LL_APR_W (APR_CREATE|APR_TRUNCATE|APR_WRITE) // "w"
......@@ -200,7 +200,7 @@ typedef LLAtomic32<S32> LLAtomicS32;
// especially do not put some time-costly operations between open() and close().
// otherwise it might lock the APRFilePool.
//there are two different apr_pools the APRFile can use:
// 1, a temperary pool passed to an APRFile function, which is used within this function and only once.
// 1, a temporary pool passed to an APRFile function, which is used within this function and only once.
// 2, a global pool.
//
......
......@@ -188,7 +188,7 @@ bool LLLFSThread::Request::processRequest()
if (mOperation == FILE_READ)
{
llassert(mOffset >= 0);
LLAPRFile infile ;
LLAPRFile infile ; // auto-closes
infile.open(mFileName, LL_APR_RB, mThread->getLocalAPRFilePool());
if (!infile.getFileHandle())
{
......@@ -204,7 +204,6 @@ bool LLLFSThread::Request::processRequest()
llassert_always(off >= 0);
mBytesRead = infile.read(mBuffer, mBytes );
complete = true;
infile.close() ;
// llinfos << "LLLFSThread::READ:" << mFileName << " Bytes: " << mBytesRead << llendl;
}
else if (mOperation == FILE_WRITE)
......@@ -212,7 +211,7 @@ bool LLLFSThread::Request::processRequest()
apr_int32_t flags = APR_CREATE|APR_WRITE|APR_BINARY;
if (mOffset < 0)
flags |= APR_APPEND;
LLAPRFile outfile ;
LLAPRFile outfile ; // auto-closes
outfile.open(mFileName, flags, mThread->getLocalAPRFilePool());
if (!outfile.getFileHandle())
{
......@@ -232,7 +231,6 @@ bool LLLFSThread::Request::processRequest()
}
mBytesRead = outfile.write(mBuffer, mBytes );
complete = true;
// llinfos << "LLLFSThread::WRITE:" << mFileName << " Bytes: " << mBytesRead << "/" << mBytes << " Offset:" << mOffset << llendl;
}
else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment