diff options
author | Jacek Antonelli | 2008-08-15 23:44:50 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:50 -0500 |
commit | 89fe5dab825a62a0e3fd8d248cbc91c65eb2a426 (patch) | |
tree | bcff14b7888d04a2fec799c59369f6095224bd08 /linden/indra/llvfs/llvfsthread.cpp | |
parent | Second Life viewer sources 1.13.3.2 (diff) | |
download | meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.zip meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.gz meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.bz2 meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.xz |
Second Life viewer sources 1.14.0.0
Diffstat (limited to 'linden/indra/llvfs/llvfsthread.cpp')
-rw-r--r-- | linden/indra/llvfs/llvfsthread.cpp | 64 |
1 files changed, 26 insertions, 38 deletions
diff --git a/linden/indra/llvfs/llvfsthread.cpp b/linden/indra/llvfs/llvfsthread.cpp index be23bd5..9226230 100644 --- a/linden/indra/llvfs/llvfsthread.cpp +++ b/linden/indra/llvfs/llvfsthread.cpp | |||
@@ -39,10 +39,10 @@ | |||
39 | //============================================================================ | 39 | //============================================================================ |
40 | // Run on MAIN thread | 40 | // Run on MAIN thread |
41 | //static | 41 | //static |
42 | void LLVFSThread::initClass(bool local_is_threaded, bool local_run_always) | 42 | void LLVFSThread::initClass(bool local_is_threaded) |
43 | { | 43 | { |
44 | llassert(sLocal == NULL); | 44 | llassert(sLocal == NULL); |
45 | sLocal = new LLVFSThread(local_is_threaded, local_run_always); | 45 | sLocal = new LLVFSThread(local_is_threaded); |
46 | } | 46 | } |
47 | 47 | ||
48 | //static | 48 | //static |
@@ -66,8 +66,8 @@ void LLVFSThread::cleanupClass() | |||
66 | 66 | ||
67 | //---------------------------------------------------------------------------- | 67 | //---------------------------------------------------------------------------- |
68 | 68 | ||
69 | LLVFSThread::LLVFSThread(bool threaded, bool runalways) : | 69 | LLVFSThread::LLVFSThread(bool threaded) : |
70 | LLQueuedThread("VFS", threaded, runalways) | 70 | LLQueuedThread("VFS", threaded) |
71 | { | 71 | { |
72 | } | 72 | } |
73 | 73 | ||
@@ -164,38 +164,26 @@ S32 LLVFSThread::writeImmediate(LLVFS* vfs, const LLUUID &file_id, const LLAsset | |||
164 | } | 164 | } |
165 | 165 | ||
166 | 166 | ||
167 | LLVFSThread::handle_t LLVFSThread::rename(LLVFS* vfs, const LLUUID &file_id, const LLAssetType::EType file_type, | 167 | // LLVFSThread::handle_t LLVFSThread::rename(LLVFS* vfs, const LLUUID &file_id, const LLAssetType::EType file_type, |
168 | const LLUUID &new_id, const LLAssetType::EType new_type, U32 flags) | 168 | // const LLUUID &new_id, const LLAssetType::EType new_type, U32 flags) |
169 | { | 169 | // { |
170 | handle_t handle = generateHandle(); | 170 | // handle_t handle = generateHandle(); |
171 | 171 | ||
172 | LLUUID* new_idp = new LLUUID(new_id); // deleted with Request | 172 | // LLUUID* new_idp = new LLUUID(new_id); // deleted with Request |
173 | // new_type is passed as "numbytes" | 173 | // // new_type is passed as "numbytes" |
174 | Request* req = new Request(handle, 0, flags, FILE_RENAME, vfs, file_id, file_type, | 174 | // Request* req = new Request(handle, 0, flags, FILE_RENAME, vfs, file_id, file_type, |
175 | (U8*)new_idp, 0, (S32)new_type); | 175 | // (U8*)new_idp, 0, (S32)new_type); |
176 | 176 | ||
177 | bool res = addRequest(req); | 177 | // bool res = addRequest(req); |
178 | if (!res) | 178 | // if (!res) |
179 | { | 179 | // { |
180 | llerrs << "LLVFSThread::read called after LLVFSThread::cleanupClass()" << llendl; | 180 | // llerrs << "LLVFSThread::read called after LLVFSThread::cleanupClass()" << llendl; |
181 | req->deleteRequest(); | 181 | // req->deleteRequest(); |
182 | handle = nullHandle(); | 182 | // handle = nullHandle(); |
183 | } | 183 | // } |
184 | 184 | ||
185 | return handle; | 185 | // return handle; |
186 | } | 186 | // } |
187 | |||
188 | //============================================================================ | ||
189 | // Runs on its OWN thread | ||
190 | |||
191 | bool LLVFSThread::processRequest(QueuedRequest* qreq) | ||
192 | { | ||
193 | Request *req = (Request*)qreq; | ||
194 | |||
195 | bool complete = req->processIO(); | ||
196 | |||
197 | return complete; | ||
198 | } | ||
199 | 187 | ||
200 | //============================================================================ | 188 | //============================================================================ |
201 | 189 | ||
@@ -242,7 +230,7 @@ LLVFSThread::Request::Request(handle_t handle, U32 priority, U32 flags, | |||
242 | } | 230 | } |
243 | 231 | ||
244 | // dec locks as soon as a request finishes | 232 | // dec locks as soon as a request finishes |
245 | void LLVFSThread::Request::finishRequest() | 233 | void LLVFSThread::Request::finishRequest(bool completed) |
246 | { | 234 | { |
247 | if (mOperation == FILE_WRITE) | 235 | if (mOperation == FILE_WRITE) |
248 | { | 236 | { |
@@ -260,13 +248,13 @@ void LLVFSThread::Request::finishRequest() | |||
260 | 248 | ||
261 | void LLVFSThread::Request::deleteRequest() | 249 | void LLVFSThread::Request::deleteRequest() |
262 | { | 250 | { |
263 | if (getStatus() == STATUS_QUEUED || getStatus() == STATUS_ABORT) | 251 | if (getStatus() == STATUS_QUEUED) |
264 | { | 252 | { |
265 | llerrs << "Attempt to delete a queued LLVFSThread::Request!" << llendl; | 253 | llerrs << "Attempt to delete a queued LLVFSThread::Request!" << llendl; |
266 | } | 254 | } |
267 | if (mOperation == FILE_WRITE) | 255 | if (mOperation == FILE_WRITE) |
268 | { | 256 | { |
269 | if (mFlags & AUTO_DELETE) | 257 | if (mFlags & FLAG_AUTO_DELETE) |
270 | { | 258 | { |
271 | delete [] mBuffer; | 259 | delete [] mBuffer; |
272 | } | 260 | } |
@@ -279,7 +267,7 @@ void LLVFSThread::Request::deleteRequest() | |||
279 | LLQueuedThread::QueuedRequest::deleteRequest(); | 267 | LLQueuedThread::QueuedRequest::deleteRequest(); |
280 | } | 268 | } |
281 | 269 | ||
282 | bool LLVFSThread::Request::processIO() | 270 | bool LLVFSThread::Request::processRequest() |
283 | { | 271 | { |
284 | bool complete = false; | 272 | bool complete = false; |
285 | if (mOperation == FILE_READ) | 273 | if (mOperation == FILE_READ) |
@@ -302,7 +290,7 @@ bool LLVFSThread::Request::processIO() | |||
302 | mVFS->renameFile(mFileID, mFileType, *new_idp, new_type); | 290 | mVFS->renameFile(mFileID, mFileType, *new_idp, new_type); |
303 | mFileID = *new_idp; | 291 | mFileID = *new_idp; |
304 | complete = true; | 292 | complete = true; |
305 | //llinfos << llformat("LLVFSThread::WRITE '%s': %d bytes arg:%d",getFilename(),mBytesRead) << llendl; | 293 | //llinfos << llformat("LLVFSThread::RENAME '%s': %d bytes arg:%d",getFilename(),mBytesRead) << llendl; |
306 | } | 294 | } |
307 | else | 295 | else |
308 | { | 296 | { |