mirror of
https://github.com/TomHarte/CLK.git
synced 2024-07-07 23:29:06 +00:00
Switched to lock guards.
This commit is contained in:
parent
99a35266e1
commit
fccdce65b9
@ -292,18 +292,16 @@ void Shader::set_uniform_matrix(const std::string &name, GLint size, GLsizei cou
|
|||||||
|
|
||||||
void Shader::enqueue_function(std::function<void(void)> function)
|
void Shader::enqueue_function(std::function<void(void)> function)
|
||||||
{
|
{
|
||||||
function_mutex_.lock();
|
std::lock_guard<std::mutex> function_guard(function_mutex_);
|
||||||
enqueued_functions_.push_back(function);
|
enqueued_functions_.push_back(function);
|
||||||
function_mutex_.unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shader::flush_functions()
|
void Shader::flush_functions()
|
||||||
{
|
{
|
||||||
function_mutex_.lock();
|
std::lock_guard<std::mutex> function_guard(function_mutex_);
|
||||||
for(std::function<void(void)> function : enqueued_functions_)
|
for(std::function<void(void)> function : enqueued_functions_)
|
||||||
{
|
{
|
||||||
function();
|
function();
|
||||||
}
|
}
|
||||||
enqueued_functions_.clear();
|
enqueued_functions_.clear();
|
||||||
function_mutex_.unlock();
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user