libnx  v4.2.2
sessionmgr.h
1 #pragma once
2 #include "../types.h"
3 #include "../kernel/mutex.h"
4 #include "../kernel/condvar.h"
5 
6 #define NX_SESSION_MGR_MAX_SESSIONS 16
7 
8 typedef struct SessionMgr
9 {
10  Handle sessions[NX_SESSION_MGR_MAX_SESSIONS];
11  u32 num_sessions;
12  u32 free_mask;
13  Mutex mutex;
14  CondVar condvar;
15  u32 num_waiters;
16 } SessionMgr;
17 
18 Result sessionmgrCreate(SessionMgr* mgr, Handle root_session, u32 num_sessions);
19 void sessionmgrClose(SessionMgr* mgr);
20 int sessionmgrAttachClient(SessionMgr* mgr);
21 void sessionmgrDetachClient(SessionMgr* mgr, int slot);
22 
23 NX_CONSTEXPR Handle sessionmgrGetClientSession(SessionMgr* mgr, int slot)
24 {
25  return mgr->sessions[slot];
26 }
NX_CONSTEXPR
#define NX_CONSTEXPR
Flags a function as constexpr in C++14 and above; or as (always) inline otherwise.
Definition: types.h:92
u32
uint32_t u32
32-bit unsigned integer.
Definition: types.h:21
Mutex
_LOCK_T Mutex
Mutex datatype, defined in newlib.
Definition: mutex.h:12
Result
u32 Result
Function error code result type.
Definition: types.h:44
SessionMgr
Definition: sessionmgr.h:8
Handle
u32 Handle
Kernel object handle.
Definition: types.h:43
CondVar
u32 CondVar
Condition variable.
Definition: condvar.h:13