Allow setThreadName to be used in linux (glibc > 2.11)
This commit is contained in:
parent
85011791e4
commit
579aa8a9d1
@ -68,12 +68,14 @@ STKTexManager::STKTexManager() : m_pbo(0), m_thread_size(0)
|
||||
STKTexManager::~STKTexManager()
|
||||
{
|
||||
removeTexture(NULL/*texture*/, true/*remove_all*/);
|
||||
#if !(defined(SERVER_ONLY) || defined(USE_GLES2))
|
||||
if (CVS->supportsThreadedTextureLoading())
|
||||
{
|
||||
pthread_cond_destroy(&m_cond_request);
|
||||
for (ThreadedTexLoader* ttl : m_all_tex_loaders)
|
||||
delete ttl;
|
||||
}
|
||||
#endif
|
||||
} // ~STKTexManager
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -18,6 +18,8 @@
|
||||
#include "graphics/threaded_tex_loader.hpp"
|
||||
#include "graphics/stk_texture.hpp"
|
||||
#include "graphics/stk_tex_manager.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
#include "utils/vs.hpp"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
@ -25,6 +27,8 @@
|
||||
void* ThreadedTexLoader::startRoutine(void *obj)
|
||||
{
|
||||
ThreadedTexLoader* ttl = (ThreadedTexLoader*)obj;
|
||||
VS::setThreadName((std::string("ThrTexLoader") +
|
||||
StringUtils::toString(ttl->m_pbo_offset / 1024 / 1024)).c_str());
|
||||
while (!ttl->m_destroy)
|
||||
{
|
||||
pthread_mutex_lock(&ttl->m_mutex);
|
||||
|
@ -40,6 +40,10 @@
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#if defined(__linux__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
|
||||
# include <pthread.h>
|
||||
#endif
|
||||
|
||||
namespace VS
|
||||
{
|
||||
#if defined(_MSC_VER) && defined(DEBUG)
|
||||
@ -77,6 +81,13 @@ namespace VS
|
||||
{
|
||||
}
|
||||
|
||||
} // setThreadName
|
||||
#elif defined(__linux__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
|
||||
static void setThreadName(const char* name)
|
||||
{
|
||||
#if __GLIBC__ > 2 || __GLIBC_MINOR__ > 11
|
||||
pthread_setname_np(pthread_self(), name);
|
||||
#endif
|
||||
} // setThreadName
|
||||
#else
|
||||
static void setThreadName(const char* name)
|
||||
|
Loading…
x
Reference in New Issue
Block a user