Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
22d62720
Commit
22d62720
authored
2 years ago
by
Rye Mutt
Browse files
Options
Downloads
Patches
Plain Diff
Tweak texture decode thread behavior to not choke
parent
14e8ad1c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/llimage/llimageworker.cpp
+27
-21
27 additions, 21 deletions
indra/llimage/llimageworker.cpp
with
27 additions
and
21 deletions
indra/llimage/llimageworker.cpp
+
27
−
21
View file @
22d62720
...
@@ -35,7 +35,8 @@ std::atomic< U32 > sImageThreads = 0;
...
@@ -35,7 +35,8 @@ std::atomic< U32 > sImageThreads = 0;
class
PoolWorkerThread
final
:
public
LLThread
class
PoolWorkerThread
final
:
public
LLThread
{
{
public:
public:
PoolWorkerThread
(
std
::
string
name
)
:
LLThread
(
name
),
mRequestQueue
(
256
)
PoolWorkerThread
(
std
::
string
name
)
:
LLThread
(
name
),
mCurrentRequest
(
NULL
)
{
{
}
}
...
@@ -43,36 +44,40 @@ class PoolWorkerThread final : public LLThread
...
@@ -43,36 +44,40 @@ class PoolWorkerThread final : public LLThread
{
{
while
(
!
isQuitting
())
while
(
!
isQuitting
())
{
{
checkPause
();
auto
*
pReq
=
mCurrentRequest
.
exchange
(
nullptr
);
LLImageDecodeThread
::
ImageRequest
*
req
=
nullptr
;
if
(
pReq
)
while
(
!
isQuitting
()
&&
mRequestQueue
.
tryPop
(
req
))
pReq
->
processRequestIntern
();
{
checkPause
();
if
(
req
)
{
req
->
processRequestIntern
();
}
}
}
}
}
}
bool
isBusy
()
{
auto
*
pReq
=
mCurrentRequest
.
load
();
if
(
!
pReq
)
return
false
;
auto
status
=
pReq
->
getStatus
();
return
status
==
LLQueuedThread
::
STATUS_QUEUED
||
status
==
LLQueuedThread
::
STATUS_INPROGRESS
;
}
bool
runCondition
()
bool
runCondition
()
{
{
return
mRequestQueue
.
size
()
>
0
;
return
mCurrentRequest
!=
NULL
;
}
}
bool
setRequest
(
LLImageDecodeThread
::
ImageRequest
*
req
)
bool
setRequest
(
LLImageDecodeThread
::
ImageRequest
*
req
)
{
{
bool
bSuccess
=
mRequestQueue
.
tryPush
(
req
);
LLImageDecodeThread
::
ImageRequest
*
pOld
{
nullptr
};
if
(
bSuccess
)
bool
bSuccess
=
mCurrentRequest
.
compare_exchange_strong
(
pOld
,
req
);
{
wake
();
wake
();
}
return
bSuccess
;
return
bSuccess
;
}
}
private
:
private
:
LLThreadSafeQueue
<
LLImageDecodeThread
::
ImageRequest
*>
mRequest
Queue
;
std
::
atomic
<
LLImageDecodeThread
::
ImageRequest
*>
m
Current
Request
;
};
};
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
...
@@ -344,13 +349,14 @@ bool LLImageDecodeThread::ImageRequest::tut_isOK()
...
@@ -344,13 +349,14 @@ bool LLImageDecodeThread::ImageRequest::tut_isOK()
bool
LLImageDecodeThread
::
enqueRequest
(
ImageRequest
*
req
)
bool
LLImageDecodeThread
::
enqueRequest
(
ImageRequest
*
req
)
{
{
for
(
size_t
num_tries
=
0
,
pool_size
=
mThreadPool
.
size
();
num_tries
<
pool_size
;
++
num_tries
)
{
{
if
(
mLastPoolAllocation
>=
mThreadP
ool
.
size
()
)
if
(
mLastPoolAllocation
>=
p
ool
_
size
)
{
{
mLastPoolAllocation
=
0
;
mLastPoolAllocation
=
0
;
}
}
auto
&
thread
=
mThreadPool
[
mLastPoolAllocation
++
];
auto
&
thread
=
mThreadPool
[
mLastPoolAllocation
++
];
if
(
thread
->
setRequest
(
req
))
if
(
!
thread
->
isBusy
()
&&
thread
->
setRequest
(
req
))
{
{
return
true
;
return
true
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Rye Mutt
@rye
mentioned in commit
aaeb8a24
·
2 years ago
mentioned in commit
aaeb8a24
mentioned in commit aaeb8a24150f2c40f02c0a90eeaf4e64aa323618
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment