mirror of
https://github.com/LNH-team/pico-launcher.git
synced 2025-12-05 13:16:06 +01:00
34 lines
693 B
C++
34 lines
693 B
C++
#include "common.h"
|
|
#include "ThreadIpcService.h"
|
|
|
|
void ThreadIpcService::ThreadMain()
|
|
{
|
|
while (true)
|
|
{
|
|
rtos_waitEvent(&_event, false, true);
|
|
if (_messageValid)
|
|
{
|
|
_messageValid = false;
|
|
HandleMessage(_message);
|
|
}
|
|
}
|
|
}
|
|
|
|
void ThreadIpcService::Start()
|
|
{
|
|
rtos_createEvent(&_event);
|
|
rtos_createThread(&_thread, 5, [] (void* arg)
|
|
{
|
|
static_cast<ThreadIpcService*>(arg)->ThreadMain();
|
|
}, this, _stack, _stackSize);
|
|
rtos_wakeupThread(&_thread);
|
|
IpcService::Start();
|
|
}
|
|
|
|
void ThreadIpcService::OnMessageReceived(u32 data)
|
|
{
|
|
_message = data;
|
|
_messageValid = true;
|
|
rtos_signalEvent(&_event);
|
|
}
|