async tasks

This commit is contained in:
2025-12-31 16:12:43 +01:00
parent f3a69571a2
commit 3a410775b5
6 changed files with 111 additions and 12 deletions

View File

@@ -30,10 +30,15 @@ void Kernel::main_loop()
while (true)
{
glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
static float angle = 0.0f;
angle += 0.1f;
glClearColor(fabs(sin(angle)), 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glFinish();
m_listener->onFrameAvailable();
{
std::lock_guard _lock(m_mutex);
m_listener->onFrameAvailable();
}
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
}
@@ -43,4 +48,12 @@ Kernel::Kernel(const std::shared_ptr<IMosisListener> &listener) : m_listener(lis
m_main_loop_thread = std::thread(&Kernel::main_loop, this);
}
void Kernel::set_listener(const std::shared_ptr<IMosisListener> &listener)
{
std::lock_guard _lock(m_mutex);
m_listener = listener;
m_listener->onServiceInitialized(true);
m_listener->onBufferAvailable(*m_aidl_buffer);
}
Kernel::~Kernel() = default;