17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-18 02:09:18 +02:00

refactor: change typedef, nullptr, scoped_lock and others

This commit is contained in:
jerrrrycho
2026-09-27 19:31:00 +02:00
parent 8fbb482350
commit b8c9724ca3
42 changed files with 186 additions and 186 deletions

View File

@@ -142,7 +142,7 @@ void render_task::run()
}
else
{
std::lock_guard guard(m_target->mutex);
std::scoped_lock guard(m_target->mutex);
if (m_target->image.size() != expectedBytes)
m_target->image.resize(expectedBytes);
@@ -362,7 +362,7 @@ void python_taskqueue::exit()
// document intent. clearing the deque also actually releases the tasks,
// which the previous code did not do (cancel() is a no-op stub).
{
std::lock_guard<std::mutex> lock(m_tasks.mutex);
std::scoped_lock lock(m_tasks.mutex);
for (auto &task : m_tasks.data)
{
task->cancel();
@@ -370,7 +370,7 @@ void python_taskqueue::exit()
m_tasks.data.clear();
}
{
std::lock_guard<std::mutex> lock(m_uploadtasks.mutex);
std::scoped_lock lock(m_uploadtasks.mutex);
m_uploadtasks.data.clear();
}
// reclaim cached python objects while the interpreter is still alive,
@@ -394,7 +394,7 @@ void python_taskqueue::exit()
auto python_taskqueue::insert(task_request const &Task) -> bool
{
if (!m_initialized || false == Global.python_enabled || Task.renderer.empty() || Task.input == nullptr || Task.target == 0)
if (!m_initialized || false == Global.python_enabled || Task.renderer.empty() || Task.input == nullptr || Task.target == nullptr)
{
return false;
}
@@ -409,7 +409,7 @@ auto python_taskqueue::insert(task_request const &Task) -> bool
bool newtaskinserted{false};
// acquire a lock on the task queue and add the new task
{
std::lock_guard<std::mutex> lock(m_tasks.mutex);
std::scoped_lock lock(m_tasks.mutex);
// check the task list for a pending request with the same target
for (auto &task : m_tasks.data)
{
@@ -554,7 +554,7 @@ void python_taskqueue::run(GLFWwindow *Context, rendertask_sequence &Tasks, uplo
task = nullptr;
// acquire a lock on the task queue and potentially grab a task from it
{
std::lock_guard<std::mutex> lock(Tasks.mutex);
std::scoped_lock lock(Tasks.mutex);
if (false == Tasks.data.empty())
{
// fifo
@@ -573,7 +573,7 @@ void python_taskqueue::run(GLFWwindow *Context, rendertask_sequence &Tasks, uplo
task->upload();
else
{
std::lock_guard<std::mutex> lock(Upload_Tasks.mutex);
std::scoped_lock lock(Upload_Tasks.mutex);
Upload_Tasks.data.push_back(task);
}
if (PyErr_Occurred() != nullptr)
@@ -608,7 +608,7 @@ void python_taskqueue::run(GLFWwindow *Context, rendertask_sequence &Tasks, uplo
void python_taskqueue::update()
{
std::lock_guard<std::mutex> lock(m_uploadtasks.mutex);
std::scoped_lock lock(m_uploadtasks.mutex);
for (auto &task : m_uploadtasks.data)
task->upload();