libnx  v4.8.0
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 }
u32 CondVar
Condition variable.
Definition: condvar.h:13
_LOCK_T Mutex
Mutex datatype, defined in newlib.
Definition: mutex.h:12
Definition: sessionmgr.h:9
u32 Handle
Kernel object handle.
Definition: types.h:43
u32 Result
Function error code result type.
Definition: types.h:44
#define NX_CONSTEXPR
Flags a function as constexpr in C++14 and above; or as (always) inline otherwise.
Definition: types.h:92
uint32_t u32
32-bit unsigned integer.
Definition: types.h:21