1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Refactor thread utility interface

- Add "thr_" prefix to thread utility functions
- Compare threadid_ts in a portable manner, where possible
This commit is contained in:
kwolekr 2015-10-16 21:12:30 -04:00
parent 836486a98e
commit 6be74d17df
6 changed files with 86 additions and 26 deletions

View file

@ -184,14 +184,14 @@ void Logger::setLevelSilenced(LogLevel lev, bool silenced)
void Logger::registerThread(const std::string &name)
{
threadid_t id = get_current_thread_id();
threadid_t id = thr_get_current_thread_id();
MutexAutoLock lock(m_mutex);
m_thread_names[id] = name;
}
void Logger::deregisterThread()
{
threadid_t id = get_current_thread_id();
threadid_t id = thr_get_current_thread_id();
MutexAutoLock lock(m_mutex);
m_thread_names.erase(id);
}
@ -215,7 +215,7 @@ const std::string Logger::getThreadName()
{
std::map<threadid_t, std::string>::const_iterator it;
threadid_t id = get_current_thread_id();
threadid_t id = thr_get_current_thread_id();
it = m_thread_names.find(id);
if (it != m_thread_names.end())
return it->second;