muteki
Loading...
Searching...
No Matches
ktls.h
Go to the documentation of this file.
1/*
2 * Copyright 2023-2025 dogtopus
3 * SPDX-License-Identifier: MIT
4 */
5
12#ifndef __OSDEP_KTLS_H__
13#define __OSDEP_KTLS_H__
14
15#include <muteki/threading.h>
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21static const unsigned int OSDEP_KTLS_KEY_MAX = sizeof(((thread_t *) NULL)->unk_0x34) / 4 - 1;
22
29extern int osdep_ktls_init(thread_t *thr);
30
38extern void **osdep_ktls_get(thread_t *thr, unsigned int key);
39
47extern void *osdep_ktls_getvalue(thread_t *thr, unsigned int key);
48
59extern int osdep_ktls_set(thread_t *thr, unsigned int key, void *value);
60
69extern void *osdep_ktls_alloc(thread_t *thr, unsigned int key, size_t bytes);
70
78extern int osdep_ktls_free(thread_t *thr, unsigned int key);
79
86extern int osdep_ktls_init_self(void);
87
94extern void **osdep_ktls_get_self(unsigned int key);
95
102extern void *osdep_ktls_getvalue_self(unsigned int key);
103
112extern int osdep_ktls_set_self(unsigned int key, void *value);
113
121extern void *osdep_ktls_alloc_self(unsigned int key, size_t bytes);
122
129extern int osdep_ktls_free_self(unsigned int key);
130
131#ifdef __cplusplus
132} // extern "C"
133#endif
134
135#endif // __OSDEP_KTLS_H__
int osdep_ktls_init_self(void)
Initialize the TLS container on the current thread.
int osdep_ktls_set_self(unsigned int key, void *value)
Store a value in the TLS slot on the current thread.
int osdep_ktls_init(thread_t *thr)
Initialize the TLS container on a specific thread.
int osdep_ktls_free_self(unsigned int key)
Free memory previously allocated by osdep_ktls_alloc().
void ** osdep_ktls_get(thread_t *thr, unsigned int key)
Get the pointer to the TLS slot on the thread descriptor.
void * osdep_ktls_getvalue_self(unsigned int key)
Get the value stored in a TLS slot of the current thread.
void * osdep_ktls_alloc(thread_t *thr, unsigned int key, size_t bytes)
Allocate memory and store the resulting pointer in the TLS slot.
void * osdep_ktls_getvalue(thread_t *thr, unsigned int key)
Get the value stored in the TLS slot on the thread descriptor.
int osdep_ktls_set(thread_t *thr, unsigned int key, void *value)
Store a value in the TLS slot.
void ** osdep_ktls_get_self(unsigned int key)
Get the pointer to the TLS slot on the current thread.
int osdep_ktls_free(thread_t *thr, unsigned int key)
Free memory previously allocated by osdep_ktls_alloc().
void * osdep_ktls_alloc_self(unsigned int key, size_t bytes)
Allocate memory and store the resulting pointer in a TLS slot of the current thread.
Native threading API.
Thread descriptor structure.
Definition threading.h:117