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:
parent
836486a98e
commit
6be74d17df
6 changed files with 86 additions and 26 deletions
|
@ -367,7 +367,7 @@ ShaderSource::ShaderSource(IrrlichtDevice *device):
|
|||
|
||||
m_shader_callback = new ShaderCallback(this, "default");
|
||||
|
||||
m_main_thread = get_current_thread_id();
|
||||
m_main_thread = thr_get_current_thread_id();
|
||||
|
||||
// Add a dummy ShaderInfo as the first index, named ""
|
||||
m_shaderinfo_cache.push_back(ShaderInfo());
|
||||
|
@ -397,7 +397,7 @@ u32 ShaderSource::getShader(const std::string &name,
|
|||
Get shader
|
||||
*/
|
||||
|
||||
if(get_current_thread_id() == m_main_thread){
|
||||
if (thr_is_current_thread(m_main_thread)) {
|
||||
return getShaderIdDirect(name, material_type, drawtype);
|
||||
} else {
|
||||
/*errorstream<<"getShader(): Queued: name=\""<<name<<"\""<<std::endl;*/
|
||||
|
@ -456,7 +456,7 @@ u32 ShaderSource::getShaderIdDirect(const std::string &name,
|
|||
/*
|
||||
Calling only allowed from main thread
|
||||
*/
|
||||
if(get_current_thread_id() != m_main_thread){
|
||||
if (!thr_is_current_thread(m_main_thread)) {
|
||||
errorstream<<"ShaderSource::getShaderIdDirect() "
|
||||
"called not from main thread"<<std::endl;
|
||||
return 0;
|
||||
|
@ -504,7 +504,7 @@ void ShaderSource::insertSourceShader(const std::string &name_of_shader,
|
|||
"name_of_shader=\""<<name_of_shader<<"\", "
|
||||
"filename=\""<<filename<<"\""<<std::endl;*/
|
||||
|
||||
sanity_check(get_current_thread_id() == m_main_thread);
|
||||
sanity_check(thr_is_current_thread(m_main_thread));
|
||||
|
||||
m_sourcecache.insert(name_of_shader, filename, program, true);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue