All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Le Douarain <marc.le-douarain@laposte.net>
To: Xenomai <xenomai@xenomai.org>
Subject: [Xenomai] Demo example of a simple periodic thread for Xenomai (Posix API)
Date: Fri, 21 Aug 2015 20:53:26 +0200	[thread overview]
Message-ID: <55D773A6.8060107@laposte.net> (raw)

Hello eveybody,

As I haven't found a little example of a periodic thread written in Posix,
I've tried to do it.

Here you will find joined the demo files example.
It can be (cross-)compiled for :
- Standard Linux
- Xenomai 2
- Xenomai 3
In the Makefile, comment 2 lines MY_CFLAGS & MY_LDFLAGS to compile for 
standard Linux.

Hope it can be helpfull for other people,
and many thanks for any comments or mistakes reports on it !
OUPPSS, JUST SEEN that XENOMAI version 3 is doing 'modes switches'... so 
there is something bad! Any idea ?

Perhaps to include a basic example like this one in the "demo" directory 
of Xenomai would be interesting!?

Best regards.

PS: I have beed disapointed at the start to discover no more 
pthread_make_periodic_np() & pthread_wait_np() functions with Xenomai 3. 
But finally now with a timerfd we can have the same sourcecode with 
standard Linux, so not too bad ! ;-)
And also no more the "__XENO__" define, but also usefull for conditional 
compilation, with the new "__COBALT__" !

-------------- next part --------------
A non-text attachment was scrubbed...
Name: demo_periodic_thread_posix.c
Type: text/x-csrc
Size: 4513 bytes
Desc: not available
URL: <http://xenomai.org/pipermail/xenomai/attachments/20150821/fabd6c48/attachment.c>
-------------- next part --------------
# MakeFile for demo of a simple periodic thread using Posix
# under 'standard' Linux
# and under Xenomai versions 2 and 3 using posix skin
# Marc Le Douarain, august 2015

#CROSS := arm-linux-gnueabi-


# For a 'standard' application...
MY_LDFLAGS = -lpthread
# Comment theses 2 lines for a 'standard' application...
MY_CFLAGS = `xeno-config --skin posix --cflags`
MY_LDFLAGS = `xeno-config --skin posix --ldflags`

CC := ${CROSS}gcc

all: demo_periodic_thread_posix

OBJS := demo_periodic_thread_posix.o

demo_periodic_thread_posix: ${OBJS}
	${CC} -o $@ ${OBJS} $(MY_LDFLAGS)

clean:
	-rm -f core ${OBJS} demo_periodic_thread_posix

demo_periodic_thread_posix.o: demo_periodic_thread_posix.c
	${CC} -c $< -o $@ $(MY_CFLAGS)


             reply	other threads:[~2015-08-21 18:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-21 18:53 Marc Le Douarain [this message]
2015-08-21 21:22 ` [Xenomai] Demo example of a simple periodic thread for Xenomai (Posix API) Gilles Chanteperdrix
2015-08-24 19:45   ` Marc Le Douarain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55D773A6.8060107@laposte.net \
    --to=marc.le-douarain@laposte.net \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.