Fixes
This commit is contained in:
@ -64,9 +64,9 @@ if(IACore_BUILD_TESTS)
|
|||||||
add_subdirectory(Tests)
|
add_subdirectory(Tests)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# -------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
# Local Development Sandboxes (not included in source control)
|
# Local Development Sandboxes (not included in source control)
|
||||||
# -------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
if (EXISTS ".local")
|
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.local")
|
||||||
add_subdirectory(.local)
|
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/.local")
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@ -14,6 +14,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#include <IACore/IACore.hpp>
|
||||||
#include <IACore/AsyncOps.hpp>
|
#include <IACore/AsyncOps.hpp>
|
||||||
|
|
||||||
namespace IACore
|
namespace IACore
|
||||||
@ -31,6 +32,7 @@ namespace IACore
|
|||||||
|
|
||||||
VOID AsyncOps::InitializeScheduler(IN UINT8 workerCount)
|
VOID AsyncOps::InitializeScheduler(IN UINT8 workerCount)
|
||||||
{
|
{
|
||||||
|
IA_RELEASE_ASSERT(IACore::IsMainThread());
|
||||||
if (!workerCount)
|
if (!workerCount)
|
||||||
workerCount = std::max((UINT32) 2, std::thread::hardware_concurrency() - 2);
|
workerCount = std::max((UINT32) 2, std::thread::hardware_concurrency() - 2);
|
||||||
for (UINT32 i = 0; i < workerCount; i++)
|
for (UINT32 i = 0; i < workerCount; i++)
|
||||||
@ -39,6 +41,8 @@ namespace IACore
|
|||||||
|
|
||||||
VOID AsyncOps::TerminateScheduler()
|
VOID AsyncOps::TerminateScheduler()
|
||||||
{
|
{
|
||||||
|
IA_RELEASE_ASSERT(IACore::IsMainThread());
|
||||||
|
|
||||||
for (auto &w : s_scheduleWorkers)
|
for (auto &w : s_scheduleWorkers)
|
||||||
{
|
{
|
||||||
w.request_stop();
|
w.request_stop();
|
||||||
@ -60,6 +64,7 @@ namespace IACore
|
|||||||
VOID AsyncOps::ScheduleTask(IN Function<VOID()> task, IN Schedule *schedule, IN Priority priority)
|
VOID AsyncOps::ScheduleTask(IN Function<VOID()> task, IN Schedule *schedule, IN Priority priority)
|
||||||
{
|
{
|
||||||
IA_ASSERT(s_scheduleWorkers.size() && "Scheduler must be initialized before calling this function");
|
IA_ASSERT(s_scheduleWorkers.size() && "Scheduler must be initialized before calling this function");
|
||||||
|
IA_RELEASE_ASSERT(IACore::IsMainThread());
|
||||||
|
|
||||||
schedule->Counter.fetch_add(1);
|
schedule->Counter.fetch_add(1);
|
||||||
{
|
{
|
||||||
@ -75,6 +80,7 @@ namespace IACore
|
|||||||
VOID AsyncOps::WaitForScheduleCompletion(IN Schedule *schedule)
|
VOID AsyncOps::WaitForScheduleCompletion(IN Schedule *schedule)
|
||||||
{
|
{
|
||||||
IA_ASSERT(s_scheduleWorkers.size() && "Scheduler must be initialized before calling this function");
|
IA_ASSERT(s_scheduleWorkers.size() && "Scheduler must be initialized before calling this function");
|
||||||
|
IA_RELEASE_ASSERT(IACore::IsMainThread());
|
||||||
|
|
||||||
while (schedule->Counter.load() > 0)
|
while (schedule->Counter.load() > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -33,6 +33,7 @@ namespace IACore
|
|||||||
|
|
||||||
VOID Terminate()
|
VOID Terminate()
|
||||||
{
|
{
|
||||||
|
IA_RELEASE_ASSERT(IsMainThread());
|
||||||
Logger::Terminate();
|
Logger::Terminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,7 +44,7 @@ namespace IACore
|
|||||||
|
|
||||||
FLOAT64 GetSecondsCount()
|
FLOAT64 GetSecondsCount()
|
||||||
{
|
{
|
||||||
return (HRClock::now() - g_startTime).count();
|
return (FLOAT64) GetTicksCount() / 1000.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT32 GetRandom(IN UINT32 seed)
|
UINT32 GetRandom(IN UINT32 seed)
|
||||||
|
|||||||
@ -1,16 +1,16 @@
|
|||||||
// IACore-OSS; The Core Library for All IA Open Source Projects
|
// IACore-OSS; The Core Library for All IA Open Source Projects
|
||||||
// Copyright (C) 2025 IAS (ias@iasoft.dev)
|
// Copyright (C) 2025 IAS (ias@iasoft.dev)
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
@ -56,7 +56,27 @@ namespace IACore
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#if IA_ENABLE_LOGGING > 0
|
#if IA_DISABLE_LOGGING > 0
|
||||||
|
STATIC VOID LogStatus(IN String &&msg)
|
||||||
|
{
|
||||||
|
UNUSED(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
STATIC VOID LogInfo(IN String &&msg)
|
||||||
|
{
|
||||||
|
UNUSED(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
STATIC VOID LogWarn(IN String &&msg)
|
||||||
|
{
|
||||||
|
UNUSED(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
STATIC VOID LogError(IN String &&msg)
|
||||||
|
{
|
||||||
|
UNUSED(msg);
|
||||||
|
}
|
||||||
|
#else
|
||||||
STATIC VOID LogStatus(IN String &&msg)
|
STATIC VOID LogStatus(IN String &&msg)
|
||||||
{
|
{
|
||||||
if (s_logLevel <= ELogLevel::VERBOSE)
|
if (s_logLevel <= ELogLevel::VERBOSE)
|
||||||
@ -80,26 +100,6 @@ namespace IACore
|
|||||||
if (s_logLevel <= ELogLevel::ERROR)
|
if (s_logLevel <= ELogLevel::ERROR)
|
||||||
LogInternal(__CC_RED, "ERROR", IA_MOVE(msg));
|
LogInternal(__CC_RED, "ERROR", IA_MOVE(msg));
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
STATIC VOID LogStatus(IN String &&msg)
|
|
||||||
{
|
|
||||||
UNUSED(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
STATIC VOID LogInfo(IN String &&msg)
|
|
||||||
{
|
|
||||||
UNUSED(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
STATIC VOID LogWarn(IN String &&msg)
|
|
||||||
{
|
|
||||||
UNUSED(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
STATIC VOID LogError(IN String &&msg)
|
|
||||||
{
|
|
||||||
UNUSED(msg);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
STATIC VOID LogInternal(IN PCCHAR prefix, IN PCCHAR tag, IN String &&msg);
|
STATIC VOID LogInternal(IN PCCHAR prefix, IN PCCHAR tag, IN String &&msg);
|
||||||
@ -114,4 +114,4 @@ namespace IACore
|
|||||||
friend VOID Initialize();
|
friend VOID Initialize();
|
||||||
friend VOID Terminate();
|
friend VOID Terminate();
|
||||||
};
|
};
|
||||||
}
|
} // namespace IACore
|
||||||
Reference in New Issue
Block a user