"cheap", RT-safe way of detecting if a thread is Xenomai or Linux

Julien Blanc julien.blanc at sprinte.eu
Mon Jan 14 09:00:26 CET 2019

Le dimanche 13 janvier 2019 à 02:33 +0000, Giulio Moro via Xenomai a
écrit :
> Hi all,
> is there a "cheap", RT-safe call that can be made in order to find
> out if the current thread is a Xenomai thread or a Linux thread?
> Also, to detect whether the Xenomai thread is in primary or secondary
> mode?

quoting Philippe, who i asked a similar question some time ago :

« cobalt_thread_pid(pthread_t) from the internal support library would
do the job. A successful call would denote a cobalt thread, -ESRCH
would denote a regular (or invalid) pthread. »

This works perfectly.


More information about the Xenomai mailing list