Commit 04db253a authored by Philippe Gerum's avatar Philippe Gerum
Browse files

lib/thread: hide low-level details from applications



evl_get_current() contains implementation details which are definitely
not part of the API and the way this works should not be exposed.
Signed-off-by: Philippe Gerum's avatarPhilippe Gerum <rpm@xenomai.org>
parent 6c7838c8
......@@ -12,6 +12,9 @@
#include <pthread.h>
#include <stdio.h>
/* Enable dlopen() on libeshi.so. */
#define EVL_TLS_MODEL "global-dynamic"
static inline
void timespec_add(struct timespec *r, const struct timespec *t)
{
......
......@@ -10,6 +10,7 @@
#include <stdio.h>
#include <evl/thread.h>
#include <evl/proxy.h>
#include "internal.h"
static __thread __attribute__ ((tls_model (EVL_TLS_MODEL)))
char fmt_buf[1024];
......
......@@ -12,9 +12,6 @@
#include <stdbool.h>
#include <evl/syscall.h>
/* Enable dlopen() on libeshi.so. */
#define EVL_TLS_MODEL "global-dynamic"
#define EVL_STACK_DEFAULT \
({ \
int __ret = PTHREAD_STACK_MIN; \
......
......@@ -17,9 +17,6 @@
#include <uapi/evl/sched.h>
#include <uapi/evl/factory.h>
/* Enable dlopen() on libevl.so. */
#define EVL_TLS_MODEL "global-dynamic"
#define EVL_STACK_DEFAULT \
({ \
int __ret = PTHREAD_STACK_MIN; \
......@@ -35,20 +32,6 @@
extern "C" {
#endif
extern __thread __attribute__ ((tls_model (EVL_TLS_MODEL)))
struct evl_user_window *evl_current_window;
static inline int evl_get_current_mode(void)
{
return evl_current_window ?
evl_current_window->state : T_INBAND;
}
static inline bool evl_is_inband(void)
{
return !!(evl_get_current_mode() & T_INBAND);
}
int evl_attach_thread(int flags, const char *fmt, ...);
int evl_detach_thread(int flags);
......@@ -64,6 +47,8 @@ int evl_switch_oob(void);
int evl_switch_inband(void);
bool evl_is_inband(void);
int evl_get_state(int efd, struct evl_thread_state *statebuf);
int evl_unblock_thread(int efd);
......
......@@ -84,12 +84,24 @@
__ret ? -errno : 0; \
})
/* Enable dlopen() on libevl.so. */
#define EVL_TLS_MODEL "global-dynamic"
extern __thread __attribute__ ((tls_model (EVL_TLS_MODEL)))
fundle_t evl_current;
extern __thread __attribute__ ((tls_model (EVL_TLS_MODEL)))
int evl_efd;
extern __thread __attribute__ ((tls_model (EVL_TLS_MODEL)))
struct evl_user_window *evl_current_window;
static inline int evl_get_current_mode(void)
{
return evl_current_window ?
evl_current_window->state : T_INBAND;
}
static inline fundle_t evl_get_current(void)
{
return evl_current;
......
......@@ -169,6 +169,11 @@ int evl_get_self(void)
return evl_efd;
}
bool evl_is_inband(void)
{
return !!(evl_get_current_mode() & T_INBAND);
}
int evl_switch_oob(void)
{
int ret;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment