mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-28 22:29:36 +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)
|
||||
{
|
||||
function_mutex_.lock();
|
||||
std::lock_guard<std::mutex> function_guard(function_mutex_);
|
||||
enqueued_functions_.push_back(function);
|
||||
function_mutex_.unlock();
|
||||
}
|
||||
|
||||
void Shader::flush_functions()
|
||||
{
|
||||
function_mutex_.lock();
|
||||
std::lock_guard<std::mutex> function_guard(function_mutex_);
|
||||
for(std::function<void(void)> function : enqueued_functions_)
|
||||
{
|
||||
function();
|
||||
}
|
||||
enqueued_functions_.clear();
|
||||
function_mutex_.unlock();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user