main
Brett 2025-04-12 16:22:37 -04:00
parent fab86f8162
commit 373fdec6d2
2 changed files with 8 additions and 3 deletions

View File

@ -27,7 +27,7 @@ macro(compile_options target_name)
sanitizers(${target_name}) sanitizers(${target_name})
endmacro() endmacro()
project(blt-gp VERSION 0.5.1) project(blt-gp VERSION 0.5.2)
include(CTest) include(CTest)

View File

@ -57,12 +57,13 @@ namespace blt::gp
BLT_WARN("Tried to remove sync from global sync state, but no thread was running"); BLT_WARN("Tried to remove sync from global sync state, but no thread was running");
return; return;
} }
std::scoped_lock lock(mutex); std::unique_lock lock(mutex);
const auto iter = std::find(syncs.begin(), syncs.end(), sync); const auto iter = std::find(syncs.begin(), syncs.end(), sync);
std::iter_swap(iter, syncs.end() - 1); std::iter_swap(iter, syncs.end() - 1);
syncs.pop_back(); syncs.pop_back();
if (syncs.empty()) if (syncs.empty())
{ {
lock.unlock();
should_run = false; should_run = false;
condition_variable.notify_all(); condition_variable.notify_all();
thread->join(); thread->join();
@ -83,8 +84,12 @@ namespace blt::gp
get_state().add(this); get_state().add(this);
} }
void sync_t::trigger(u64 current_time) void sync_t::trigger(const u64 current_time)
{ {
if ((m_timer_seconds && (current_time % *m_timer_seconds == 0)) || (m_generations && (current_time % *m_generations == 0)))
{
}
} }
sync_t::~sync_t() sync_t::~sync_t()