libctru/libctru/source/internal.h
TuxSH b332b7cca9 Implement per-thread non-blocking behavior for srvGetServiceHandle...
implement srvWaitForPortRegistered and srvIsPortRegistered as well.
2018-01-14 18:47:14 +01:00

38 lines
880 B
C

#pragma once
#include <sys/reent.h>
#include <3ds/types.h>
#include <3ds/result.h>
#include <3ds/svc.h>
#include <3ds/thread.h>
#define THREADVARS_MAGIC 0x21545624 // !TV$
#define FS_OVERRIDE_MAGIC 0x21465324 // !FS$
// Keep this structure under 0x80 bytes
typedef struct
{
// Magic value used to check if the struct is initialized
u32 magic;
// Pointer to the current thread (if exists)
Thread thread_ptr;
// Pointer to this thread's newlib state
struct _reent* reent;
// Pointer to this thread's thread-local segment
void* tls_tp; // !! Keep offset in sync inside __aeabi_read_tp !!
// FS session override
u32 fs_magic;
Handle fs_session;
// Whether srvGetServiceHandle is non-blocking in case of full service ports.
bool srv_blocking_policy;
} ThreadVars;
static inline ThreadVars* getThreadVars(void)
{
return (ThreadVars*)getThreadLocalStorage();
}