c++ify ipc server
This commit is contained in:
1 parent
fa9f911620
commit
fb07924a3d
1 file changed
+9
-5
@@ -28,6 +28,7 @@
|
||||
#include <i2c.h>
|
||||
#include <max17050.h>
|
||||
#include <switch.h>
|
||||
#include <switch.hpp>
|
||||
#include <tmp451.h>
|
||||
|
||||
#include "../file/config.hpp"
|
||||
@@ -39,6 +40,9 @@
|
||||
#include "ipc_service.hpp"
|
||||
#include <ipc_server.hpp>
|
||||
#include <lockable_mutex.h>
|
||||
|
||||
using namespace nx;
|
||||
|
||||
namespace ipcService {
|
||||
|
||||
namespace {
|
||||
@@ -270,7 +274,7 @@ namespace ipcService {
|
||||
|
||||
void Initialize() {
|
||||
std::int32_t priority;
|
||||
Result rc = svcGetThreadPriority(&priority, CUR_THREAD_HANDLE);
|
||||
Result rc = svc::GetThreadPriority(&priority, CUR_THREAD_HANDLE);
|
||||
ASSERT_RESULT_OK(rc, "svcGetThreadPriority");
|
||||
rc = ipcServerInit(&gServer, HOCCLK_IPC_SERVICE_NAME, 42);
|
||||
ASSERT_RESULT_OK(rc, "ipcServerInit");
|
||||
@@ -281,7 +285,7 @@ namespace ipcService {
|
||||
|
||||
void Exit() {
|
||||
SetRunning(false);
|
||||
Result rc = threadClose(&gThread);
|
||||
Result rc = thread::Close(&gThread);
|
||||
ASSERT_RESULT_OK(rc, "threadClose");
|
||||
rc = ipcServerExit(&gServer);
|
||||
ASSERT_RESULT_OK(rc, "ipcServerExit");
|
||||
@@ -296,11 +300,11 @@ namespace ipcService {
|
||||
gRunning = running;
|
||||
|
||||
if (running) {
|
||||
Result rc = threadStart(&gThread);
|
||||
Result rc = thread::Start(&gThread);
|
||||
ASSERT_RESULT_OK(rc, "threadStart");
|
||||
} else {
|
||||
svcCancelSynchronization(gThread.handle);
|
||||
threadWaitForExit(&gThread);
|
||||
svc::CancelSynchronization(gThread.handle);
|
||||
thread::WaitForExit(&gThread);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user