2018-05-03 11:10:05 +01:00
|
|
|
#include <switch.h>
|
2018-05-03 23:15:00 +01:00
|
|
|
#include <stratosphere.hpp>
|
2018-05-03 11:10:05 +01:00
|
|
|
#include "pm_process_track.hpp"
|
2018-05-04 06:58:25 +01:00
|
|
|
#include "pm_registration.hpp"
|
2018-05-06 09:23:47 +01:00
|
|
|
#include "pm_debug.hpp"
|
2018-05-03 11:10:05 +01:00
|
|
|
|
2018-05-03 23:15:00 +01:00
|
|
|
void ProcessTracking::MainLoop(void *arg) {
|
2018-05-04 06:58:25 +01:00
|
|
|
/* Make a new waitable manager. */
|
2018-05-06 09:23:47 +01:00
|
|
|
WaitableManager *process_waiter = new WaitableManager(1000);
|
2018-05-04 06:58:25 +01:00
|
|
|
process_waiter->add_waitable(Registration::GetProcessList());
|
2018-05-06 09:23:47 +01:00
|
|
|
|
|
|
|
static unsigned int i = 0;
|
2018-05-04 06:58:25 +01:00
|
|
|
/* Service processes. */
|
2018-05-06 09:23:47 +01:00
|
|
|
while (true) {
|
|
|
|
process_waiter->process_until_timeout();
|
|
|
|
|
|
|
|
i++;
|
|
|
|
if (Registration::TryWaitProcessLaunchStartEvent()) {
|
|
|
|
Registration::HandleProcessLaunch();
|
|
|
|
}
|
|
|
|
if (i > 1000000) {
|
|
|
|
Reboot();
|
|
|
|
}
|
|
|
|
}
|
2018-05-04 06:58:25 +01:00
|
|
|
|
|
|
|
delete process_waiter;
|
|
|
|
svcExitThread();
|
2018-05-03 11:10:05 +01:00
|
|
|
}
|