Make operator inline

This commit is contained in:
Benau 2017-03-15 11:40:41 +08:00
parent f920ed7f97
commit 562131b53f
3 changed files with 7 additions and 11 deletions

View File

@ -425,10 +425,3 @@ void STKTexManager::checkThreadedLoadTextures(bool util_queue_empty)
}
#endif
} // checkThreadedLoadTextures
// ----------------------------------------------------------------------------
bool STKTexManager::SmallestTexture::operator()
(const video::ITexture* a, const video::ITexture* b) const
{
return a->getTextureSize() > b->getTextureSize();
} // SmallestTexture::operator

View File

@ -57,8 +57,11 @@ private:
class SmallestTexture
{
public:
bool operator()(const irr::video::ITexture* a,
const irr::video::ITexture* b) const;
inline bool operator()(const irr::video::ITexture* a,
const irr::video::ITexture* b) const
{
return a->getTextureSize() > b->getTextureSize();
}
};
std::priority_queue<irr::video::ITexture*,
std::vector<irr::video::ITexture*>, SmallestTexture>

View File

@ -33,7 +33,6 @@ void* ThreadedTexLoader::startRoutine(void *obj)
{
pthread_mutex_lock(&ttl->m_mutex);
bool finished = ttl->finishedLoading();
bool has_completed_tex = !ttl->m_completed_textures.empty();
pthread_mutex_unlock(&ttl->m_mutex);
if (finished)
{
@ -41,7 +40,8 @@ void* ThreadedTexLoader::startRoutine(void *obj)
}
pthread_mutex_lock(ttl->m_texture_queue_mutex);
bool waiting = ttl->m_stktm->isThreadedLoadTexturesEmpty();
ttl->m_last_queue_ready.setAtomic(has_completed_tex && waiting);
ttl->m_last_queue_ready.setAtomic(!ttl->m_completed_textures.empty() &&
waiting);
while (waiting)
{
pthread_cond_wait(ttl->m_cond_request, ttl->m_texture_queue_mutex);