Commit Graph

12 Commits

Author SHA1 Message Date
Philippe Gerum 354e0eb91e lib/thread: move evl_detach_self() out of line
Refrain from inlining core services, so that interposing on them via
dynamic linking tricks is made easier.

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
2020-12-13 12:33:17 +01:00
Philippe Gerum 04db253a39 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 <rpm@xenomai.org>
2020-12-13 12:29:25 +01:00
Philippe Gerum f27fc99387 lib: introduce the interface to observables
Since ABI 23, the core provides the new observable element, which
enables the observer design pattern. Any EVL thread is in and of
itself an observable which can be monitored for events too.

As a by-product, the poll interface can now be given a user-defined
opaque data when subscribing file descriptors to poll elements, which
the core passes back on return to evl_poll().

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
2020-04-30 12:11:14 +02:00
Philippe Gerum dbb8d32f08 lib/thread: add services to set/clear thread mode bits
Open-coding oob_ioctl() calls to set/clear mode bits in apps is
unhandy and fairly ugly. Let's provide sanctioned services for these
requests, namely evl_set_thread_mode() and evl_clear_thread_mode()
respectively.

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
2020-04-23 14:30:58 +02:00
Philippe Gerum 207ad9feb3 lib/thread: add unblock and demotion services
Starting with ABI 22, we can ask for the core to unblock a thread from
a wait state, which may include forcing it out of any real-time
scheduling class by demoting it to SCHED_WEAK in the same move.

Export evl_unblock_thread() and evl_demote_thread() as the
corresponding wrappers.

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
2020-04-23 12:52:54 +02:00
Philippe Gerum c8b3bb1cca lib/thread: rename evl_attach_self_flags() to evl_attach_thread()
Signed-off-by: Philippe Gerum <rpm@xenomai.org>
2020-04-21 19:08:05 +02:00
Philippe Gerum 9b42b85ed8 lib: introduce element visibility attribute
Since core ABI 21, users can decide whether a new element should be
made public or private depending on the value of clone flags added to
the new long form of all element creation calls, i.e. evl_create_*().
All evl_new_*() calls become a shorthand for their respective long
form with reasonable default arguments, including private visibility.

As a shorthand, libevl also interprets a slash character leading the
name argument passed to these services as an implicit request for
creating a public element. In other words, this is the same as passing
EVL_CLONE_PUBLIC in the clone flags.

A public element appears as a cdev in the /dev/evl hierarchy, which
means that it is visible to other processes, which may share it. On
the contrary, a private element is only known from the process
creating it, although it does appear in the /sysfs hierarchy
regardless.

e.g.:

efd = evl_attach_self("/visible-thread");

total 0
crw-rw----    1 root     root      248,   1 Apr 17 11:59 clone
crw-rw----    1 root     root      246,   0 Apr 17 11:59 visible-thread

or,

efd = evl_attach_self("private-thread");

total 0
crw-rw----    1 root     root      248,   1 Apr 17 11:59 clone

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
2020-04-18 20:43:02 +02:00
Philippe Gerum d32a11700c include/evl: fix unresolved references to evl_sched_attrs.sched_priority
sched_priority is implemented as a macro by glibc which serves as a
wrapper to the real attribute field in schedparam. Some architectures
may use this trick to hide the actual identifier from the user code,
so make sure to always pull <sched.h> before referencing
sched_priority in uapi/ headers, so that such wrapping also happens
when struct evl_sched_attrs is defined.

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
2020-04-17 07:00:12 +02:00
Philippe Gerum 12f277eeed lib/sched: group all sched-related calls 2019-07-01 08:37:35 +02:00
Philippe Gerum 28e6b7d64c include/evl: thread: include signal bits 2019-06-27 17:47:30 +02:00
Philippe Gerum 979e0fb716 lib/thread: cosmetic changes for readability 2019-06-16 12:13:51 +02:00
Philippe Gerum eda7791f9b evl: rename evenless/ paths to evl/ 2019-03-10 16:25:02 +01:00